cart: empty [ Login ]

Can we place another dwg on a new model

< previous  1 2 
Abhishek
7/19/2019 10:50 AM
And even after I replace the code with following From
C# Code:
CloneContext cloneContext = new CloneContext(sourceModel, bl.model, ReferenceResolutionType.CloneMissing);
TO
C# Code:
CloneContext cloneContext = new CloneContext(sourceModel, model, ReferenceResolutionType.CloneMissing);
and use this
C# Code:
bl.Entities.Add(clonedEntity);
still the entities are getting place at there original location from the original dxf file "obj.dxf"
Wout
7/19/2019 11:04 AM
I don't know why you make up your own incorrect code rather than following the correct example in the DxfInsert documentation. You generally set the DxfInsert.InsertionPoint (or specify in the DxfInsert constructor) rather than the block's BasePoint, which is pretty clearly written in the DxfInsert documentation and example. If you would just follow the DxfInsert documentation example you wouldn't get all these problems. Also you don't need this:
C# Code:
bl.Model.Header.InsertionBase = new Point3D(10, 10, 0);
- Wout
Abhishek
7/19/2019 11:19 AM
That's why I said I tried many things. I started with DxfInsert.InsertionPoint then I tried DxfBlock.BasePoint and then in forum only I read about Header.InsertionBase
Wout
7/19/2019 11:23 AM
You just need to follow the example code, which exactly shows how the DxfBlock and DxfInsert should be used. - Wout
Abhishek
7/19/2019 12:17 PM
I made a dxf file using the library and then imported and placed and it worked fine but it's not working with the file i was using earlier which is not made using CadLib and I will be getting it from different locations. The original file is Dxf14 version, so I created Dxf14 version sample dxf using cadlib and it also worked fine for cloning and placement.
Wout
7/19/2019 2:13 PM
If you provide input data + code, then I can look into it. - Wout
Abhishek
7/22/2019 10:42 AM
C# Code:
DxfModel model = new DxfModel(DxfVersion.Dxf15); DxfBlock bl = new DxfBlock("smaple"); model.Blocks.Add(bl); using (DxfModel sourceModel = CadReader.Read("sample.dxf")) { // The ReferenceResolutionType.CloneMissing will result in the DASH_DOT line type created // above to also be cloned indirectly as a result of cloning the entities. CloneContext cloneContext = new CloneContext(sourceModel, bl.Model, ReferenceResolutionType.CloneMissing); foreach (DxfEntity entity in sourceModel.Entities) { DxfEntity clonedEntity = (DxfEntity)entity.Clone(cloneContext); bl.Entities.Add(clonedEntity); } cloneContext.ResolveReferences(); } model.Entities.Add(new DxfInsert(bl, new Point3D(10, 10, 0))); model.Entities.Add(new DxfInsert(bl, new Point3D(60, 10, 0))); DwgWriter.Write("sampleforwout.dwg", model);
Abhishek
7/24/2019 5:37 AM
Hi Wout any updates on this?
< previous  1 2