Macro import dxf

Anyone would know how to create a macro to open the DXF in 3D curve and put the unit in millimeters without going through the dialog box?

 

Thank you.

 

Hello

VBA programming is not a problem?

See these links which give good leads:

http://help.solidworks.com/2013/english/api/sldworksapi/Import_DXF_File_into_Part_Sketch_Example_VB.htm

http://help.solidworks.com/2014/english/api/sldworksapi%5Cimport_dxf_dwg_file_example_vb.htm

I'm able to do it, but it takes time and learning VBA programming is always beneficial and not very complicated.

 

To start, we can record a macro when importing a DXF3D into SolidWorks, and then see what the code is:

http://help.solidworks.com/2013/french/SolidWorks/sldworks/c_recording_playing_macros.htm

 

Precisely I tested but the import of the DXF the dialog box does not open when I restart the macro and therefore the DXF opens on a drawing...


macro1.swp
So you want to see the dialog box to choose a file?

I also think that the problem may be that your file is a document that includes 4

so SW may not understand since there is no constraint relationship between these parts

they are independent

  

 

and you are looking to create solids?

@+ ;-))

#. JL:

I want to choose the "3D curve or model" option when I launch the macro in order to recreate the model in 3D. 

see PJ

 

#GT22:

how to explain that SOLIDWORKS generates the 4 parts when you do it manually?

There must be a particular configuration I think.


dxf.png
1 Like

That's precisely where the problem is

and I don't have an answer but the fact is

if we save your edrawing so the link in an X file

impossible to open it in Solidworks without conflict

at least that's what I saw and that's what it resulted despite X tests on SW 2012 premium

maybe you need to convert your DXF 3D file

preferably parasolid or IGES, STEP

Is your goal to find all the X Y Z numerical coordinates of the room?

so for me already it is necessary that each part file be independent

This is a first step

After saving each piece independently  and naming them in a clean file

well me say that

@+ ;-))

1 Like
I think the option you're looking for is here:

http://help.solidworks.com/2012/English/api/swconst/SolidWorks.Interop.swconst~SolidWorks.Interop.swconst.swImportDxfDwg_ImportMethod_e.html

1 Like