Hello
I explain below what I am trying to do, I hope I will be clear.... FYI I don't know anything about VB
I want to automate the creation of my DXFs
From the attached excel file,
variables: if column value X="New" and column value Y="Manufactured" or "Part/Op Set" then open the 3d of the corresponding parts (path = X6 cell value & L column value & .sldprt) and save them in ". DXF" to the following address "\\10.3.0.145\common\DAO\Iges-fao" under the corresponding name in column M of the excel table
and loop this on all rows where variables X="New" and column value Y="Manufactured" or "Part/Op Set" will be found
thank you for your help
If someone could manage to do this to me, it would help me a lot and if possible at the same time explain the lines of the macro even better....
I hope I have been clear
Thank you for your help
template_bom_v2.xlsm
Here is the code to open a room or MEP from SW:
Sub EssaiSW()
Dim swApp As SldWorks.SldWorks
Dim swModelUn As SldWorks.ModelDoc2
Dim swModelDeux As SldWorks.ModelDoc2
If swApp Is Nothing Then
Set swApp = CreateObject("SLDWORKS.application")
swApp.Visible = True
Else
Set swApp = Application.SldWorks
End If
Set swDocSpecification = swApp.GetOpenDocSpec("C:\Temp\Pièce5.sldprt")
Set swModelUn = swApp.OpenDoc7(swDocSpecification)
MsgBox swModelUn.GetTitle
Set swDocSpecification = swApp.GetOpenDocSpec("C:\Temp\Pièce5.slddrw")
Set swModelUn = swApp.OpenDoc7(swDocSpecification)
MsgBox swModelUn.GetTitle
swApp.CloseDoc swModelUn.GetTitle
Set swModelUn = swApp.ActiveDoc
MsgBox swModelUn.GetTitle
Set swDocSpecification = swApp.GetOpenDocSpec("C:\Temp\Pièce6.sldprt")
Set swModelDeux = swApp.OpenDoc7(swDocSpecification)
swApp.CloseDoc swModelUn.GetTitle
MsgBox swModelDeux.GetTitle
swApp.CloseDoc swModelDeux.GetTitle
End Sub
You also have to add the following ref to your Excel macro:
On the other hand, if you don't know anything about vba, you'd better get your list of files to process with Excel formulas in an additional tab. We have to recover the complete path.
(if column value X="New" and column value Y=" Manufactured" or " Part/Op Set" then open the 3d of the corresponding parts (path = cell value X6 & column value L & .sldprt) and save them in ". DXF" at the following address "\\10.3.0.145\common\DAO\Iges-fao" under the corresponding name in column M of the excel table...)
And then you export this list in csv and you create a rule in Integration (Free for Mycadservice customers) to export in bulk all the files of your csv list:
https://help.visiativ.com/mycadtools/2020/fr/Integration.html
This way via Integration is much simpler if you don't have any knowledge of VBA.
All you have to do is do an automated sorting via Excel formula and then export to csv.
Import your csv list into Integration apply your rule to it (export your part in dwg or dxf)
While for the VBA you still have to deal with the loopback with the conditions, the dxf export and implement all this in Excel, without knowledge it may be very complicated.
1 Like