Drawing Automation

Drawing Automation

Anonymous
Not applicable
608 Views
5 Replies
Message 1 of 6

Drawing Automation

Anonymous
Not applicable

Hi,

I've recently noticed the new feature on drawings called 'drawing formats.'  It would save so much time to enter a drawing that already has a flat pattern on it and some basic views.  The problem is that the drawing format feature makes you manually search for the file you want to use, rather than dropping in a base view to get started.  I was wondering if there was a rule that can be ran from the sheet metal file that can launch a drawing for you with the automated format. 

 

Thanks!

0 Likes
609 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

Do you mean to run a rule that creates a drawing with a view from the flatpattern view activated in a sheetmetal-part at that moment?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 6

Anonymous
Not applicable

@bradeneuropeArthur 

 

Yes, but you don't necessarily have to be in the sheet metal part's flat pattern.  Just running the rule from the part file.  In fact I plan to make one for parts too, not just sheet metal.  The sheet metal rule will be a little different because I want the flat pattern to appear on the drawing as one of the pre-set views when you run the rule.

0 Likes
Message 4 of 6

bradeneuropeArthur
Mentor
Mentor

What version of inventor are you using?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 6

Anonymous
Not applicable

@bradeneuropeArthur 

 

I'm on 2021.

So far I have this code that I edited. The problem with it is that it only scales one of the views, not all.  Also, I've seen people scale this using a 'draggable' button that adjusts the views, more importantly, the views updated as you flipped through the different scales.  Right now, it asks you for what scale you want, and you have to guess what it will look like.

 

'Code By @ClintBrown3D
'Originally posted at https://clintbrown.co.uk/automatic-drawings-With-ilogic/
'Check if this is a drawing file
Dim doc = ThisDoc.Document
If doc.DocumentType = kDrawingDocumentObject Then
GoTo DRAWINGcode :
End If

'In parts & asemblies - Write file name and path to temp text file
oWrite = System.IO.File.CreateText("C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\part.txt")
oWrite.WriteLine(ThisDoc.PathAndFileName(True))
oWrite.Close()
oFilePather = ThisDoc.Path & "\"

'In parts & asemblies - Write new drawing name to temp text file
oWrite = System.IO.File.CreateText("C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\partno.txt")
oWrite.WriteLine(oFilePather & iProperties.Value("Custom", "Item Code") & ".dwg")
oWrite.Close()

'Read Drawing name from text file
oRead = System.IO.File.OpenText("C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\partno.txt")
EntireFile1 = oRead.ReadLine()
oRead.Close()
oDrawingName = EntireFile1

'Copy the Template file > keep templates saved in your project workspace, you need a separate part and assembly template
Dim oCopyFiler As String = "www.clintbrown.co.uk"
If doc.DocumentType = kAssemblyDocumentObject Then
oCopyFiler = "C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\ASSEMBLY_TEMPLATE.dwg"
Else If doc.DocumentType = kPartDocumentObject Then
oCopyFiler = "C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\PART_TEMPLATE.dwg"
End If

' Check if drawing exists - If it does, opening existing drawing
If System.IO.File.Exists(oDrawingName & DWGType) Then
MessageBox.Show("Drawing already exists > Opening Existing Drawing", "@ClintBrown3D")
ThisDoc.Launch(oDrawingName & DWGType)
Return
End If

'Launch New drawing
Dim oNewFiler As String = EntireFile1
System.IO.File.Copy(oCopyFiler,oNewFiler,(True))
ThisDoc.Launch(oNewFiler)

DRAWINGcode :

	

'Read in File name - For reference
oRead = System.IO.File.OpenText("C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\part.txt")
EntireFile = oRead.ReadLine()
oRead.Close()
oPartPath = EntireFile

'Replace Drawing Reference
doc = ThisApplication.ActiveDocument
Dim oFileDesc As FileDescriptor
oFileDesc = doc.ReferencedFileDescriptors(1).DocumentDescriptor.ReferencedFileDescriptor
oFileDesc.ReplaceReference(oPartPath)
doc.Update()

'Read in new name for Drawing
oRead = System.IO.File.OpenText("C:\JACKRABBIT\INVENTOR TEMPLATES 2022\MISC\partno.txt")
EntireFile1 = oRead.ReadLine()
oRead.Close()
oDrawingName = EntireFile1

'Save this drawing
ThisDoc.Save

'Scale the Drawing - Note your drawing views names("VIEW1")&("VIEW4") must match the template
oMyParameter = ThisDrawing.Document.Parameters.UserParameters
oParameter = oMyParameter.AddByValue("Scaler", "1:5", UnitsTypeEnum.kTextUnits)
MultiValue.SetList("Scaler","1:1", "1:2", "1:4", "1:5", "1:10", "1:20", "1:25", "1:50", "1:100")

Scaler = InputListBox("Set Drawing Scale", MultiValue.List("Scaler"), Scaler, Title := "Scale = " & ActiveSheet.View("VIEW1").ScaleString, ListName := "List")
ActiveSheet.View("VIEW1").ScaleString = Scaler
ActiveSheet.View("VIEW4").ScaleString = Scaler
ActiveSheet.View("VIEW5").ScaleString = Scaler
Parameter.Param("Scaler").Delete

Exiter :
'Msgbox("Scale not Changed")

 

0 Likes
Message 6 of 6

bradeneuropeArthur
Mentor
Mentor

Why don't you use this build in feature:

bradeneuropeArthur_0-1614801087801.png

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes