Automated Sheet Metal Drawings

Automated Sheet Metal Drawings

Anonymous
Not applicable
1,854 Views
4 Replies
Message 1 of 5

Automated Sheet Metal Drawings

Anonymous
Not applicable

I have a VB and Ilogic mash up that creates automated drawings for sheet Metal parts that look like the example I linked.  I'm making this post in hopes that someone could help me make it run faster as well as put it out there for other people to use.  

To run this;

1) Save "Create Drawing" and "RuleForDrawing" as external Ilogic rules

2) Save the "Part Drawing Template" and change the location inside "Create Drawing" 

3)Run the "Draw_Sheetmetal" macro from an assembly with at least one Sheet Metal part in it

I'm sure on of the biggest ways to speed this up would be to change all of the code to either Vb or Ilogic so that it doesn't have to reference the other, but I'm not that great at coding and am not sure I could accomplish that.    

I appreciate any help and hope that this can help people looking to accomplish a similar task.

Accepted solutions (1)
1,855 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Here's the rest of the attachments specified above.

0 Likes
Message 3 of 5

Anonymous
Not applicable

I realized that there's one more thing I would want it to do which would be to save all the files into a folder called Drawings "assembly name"  but I'm not sure how I would accomplish that currently since the macro runs in the assembly and the part and the Ilogic only runs in the part and the drawing so It wouldn't know the assembly name.

0 Likes
Message 4 of 5

Anonymous
Not applicable

I have this running which adds the Assembly name to a custom Iproperty in each part:

Dim customPropSet As PropertySet
Dim invPartDoc As PartDocument
Set invPartDoc = ThisApplication.ActiveDocument
Set customPropSet = invPartDoc.PropertySets.Item("User Defined Properties")
Dim AssemblyName As Property
On Error Resume Next

Set AssemblyName = customPropSet.Add(oAsmName, "AssemblyName")

And this which adds a folder to the same location as the Assembly:

Dim oFolder As String
    oFolder = oPath & "\" & "Drawings " & oAsmName
    
    'Check for the DXF folder and create it if it does not exist
    If Len(Dir(oFolder, vbDirectory)) = 0 Then
        MkDir oFolder

But I can't quite get the Ilogic to save the Drawings to the folder, this is what I have so far:

oDrawDoc = ThisApplication.ActiveDocument
Dim oRef as Document
 oRef = oDrawDoc.ReferencedDocuments.Item(1)
Dim New_Folder As String = ThisDoc.Path
Dim AsmName As String
AsmName = oRef.PropertySets.Item(4).Item("AssemblyName").Value
SavePlace = New_Folder & "\" & "Drawings" & AsmName

 I appreciate any help.

Message 5 of 5

Anonymous
Not applicable
Accepted solution

I figured out the save and added stuff to make it sort the files by gauge and thickness.

I'll link the updated versions of the code.