hello,
i have created a simle part file which has a User parameter (L). The part should be cut with a laser cutting machine.
My problem is, that there is 76 different dimensions for L parameter. So I have to generate 76 different dxf drawing.
is there a way to crearte a VBA code for modifying the L parameter, regenerate the part file, and export the surface of the part file as a DXF file?
regards,
arnold
Here is quick example, was written in a hurry,
so check all names and value
''--- Borrowed from on Juergen Menzi ---'' Public Sub WblockSelection(detailName As String, Lparam As Double) Dim wdoc As AcadDocument Dim SelSet As AcadSelectionSet Set SelSet = NewSelectionSet("WBLOCK_SET") With ThisDrawing SelSet.SelectOnScreen Dim path As String path = .FullName Dim dwgName As String dwgName = detailName & "_" & Replace(CStr(Lparam), ",", "_", 1, -1, vbTextCompare) Dim outFile As String outFile = .GetVariable("dwgprefix") outFile = outFile & dwgName & ".dwg" .Wblock outFile, SelSet End With Dim dxfFolder As String dxfFolder = "C:\Test\DxfFolder\" Dim dxfName As String dxfName = dxfFolder & dwgName & ".dxf" Set wdoc = Application.Documents.Open(outFile, False, "") Call wdoc.SaveAs(dxfName, ac2000_dxf, Nothing) wdoc.Close Kill outFile End Sub Public Function NewSelectionSet(AssNme As String) As AcadSelectionSet Dim SelSet As AcadSelectionSet Dim SelCol As AcadSelectionSets With ThisDrawing Set SelCol = .SelectionSets For Each SelSet In SelCol If SelSet.Name = AssNme Then .SelectionSets.Item(AssNme).Delete Exit For End If Next Set SelSet = .SelectionSets.Add(AssNme) End With Set NewSelectionSet = SelSet End Function Public Sub Test_Wblock() Dim lpar As Double lpar = 1200.5 Dim shp As String shp = "FOO" Call WblockSelection(shp, lpar) End Sub
thanks for the example.
is this for autocad?
I have 3-4 dimensions driven of this L parameter. can the part generation be done in autocad?
i don't really understand ehat are you doing in the NewSelectionSet function.
your function should update the part with the new dimensions?
This code will work with existing details, say if these has different L parameter
and yoiu now yhis value as well as detail name then you can create dxf's using this code
Or you wanted be on another lanfguage, say VB.NET or C#?
Also you could be uppload the picture here to show your detail
But sorry I can more help. some my own proble occurs