Hello,
I have a problem with importing dxf into a part sketch.
With the InsertDwgOrDxfFile method (example1) the units are 25.4 (inches) too big, i need mm.
With the loadfile4 method, the dxf is imported into a new part. I want it into an existing part .
Does anybody knows the right way to do it ???
public void Main() { string file = @"c:\\test.dxf"; ModelDoc2 swDoc = null; bool boolstatus = false; swDoc = ((ModelDoc2)(swApp.ActiveDoc)); boolstatus = swDoc.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, false, 0, null, 0); Feature myFeature = null; myFeature = ((Feature)(swDoc.FeatureManager.InsertDwgOrDxfFile (file) )); }Example 1 InsertDwgOrDxfFile
| Example 2 LoadFile4 |
|---|
public void Main() { bool boolstatus = false; ModelDoc2 swModel = null; swApp = (SldWorks)Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application")); string path = @"C:\\test.dxf"; IImportDxfDwgData Data = (IImportDxfDwgData)swApp.GetImportFileData(path); Data.set_ImportMethod("", (int)swImportDxfDwg_ImportMethod_e.swImportDxfDwg_ImportToPartSketch); Data.set_LengthUnit("" ,(int)swLengthUnit_e.swMM); int err = -1; swModel = swApp.LoadFile4(path,"", Data, ref err); } |
