cart: empty [ Login ]

Can we place another dwg on a new model

1 2  next > 
Abhishek
7/11/2019 9:46 AM
Hi, I want to use icons which are present in a separate dwg file, can i embed those on a particular location and not as external reference so that it is in a single file only?
Wout
7/11/2019 10:02 PM
Hi, You can clone objects from one model to another. See the documentation on DxfHandledObject.Clone() for an example and follow it closely. - Wout
Abhishek
7/18/2019 7:54 AM
I tried cloning and also added all the entities to a dxf block but was unable to place it on a desired location. The object i am trying to clone consists of multiple entites.
Abhishek
7/18/2019 8:01 AM
Is there a way to group all the entities in a single object and then adjust the placement of that object?
Wout
7/18/2019 8:54 AM
See the documentation on DxfBlock and DxfInsert. - Wout
Abhishek
7/19/2019 6:31 AM
Hi wout I tried some things from the documentation but nothing seems to work. I am new to your library and currently on evaluation period, can you please help me so that I can finalize the library we need for our development.
Wout
7/19/2019 10:13 AM
Can you please post your code and be more specific about "nothing seems to work", this doesn't give me any information at all. - Wout
Abhishek
7/19/2019 10:19 AM
I tried something like this
C# Code:
DxfBlock bl = new DxfBlock("OBJ") { BasePoint = new Vector3D(10, 10, 0) }; model.Blocks.Add(bl); bl.Model.Header.InsertionBase = new Point3D(10, 10, 0); using (DxfModel sourceModel = CadReader.Read("obj.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.Model.Entities.Add(clonedEntity); } cloneContext.ResolveReferences(); } //bl.Entities.Add DxfInsert nw = new DxfInsert(bl, new Point3D(10,10,0)); nw.ApplyInsertionPointOffsetToAttributes(); model.Entities.Add(nw);
Wout
7/19/2019 10:40 AM
You didn't follow the example correctly.
C# Code:
bl.Model.Entities.Add(clonedEntity);
should be
C# Code:
bl.Entities.Add(clonedEntity);
- Wout
Abhishek
7/19/2019 10:44 AM
But clone context doesn't takes DxfBlock as parameter. "CloneContext cloneContext = new CloneContext(sourceModel, bl.Model, ReferenceResolutionType.CloneMissing);"
1 2  next >