Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autofill Scale?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
elixin77
928 Views, 3 Replies

Autofill Scale?

Hi all.

 

The company I work for uses templates for our casting and machine drawings. 

 

I'm wondering if there is a way to auto-fill some boxes on our template, most notably Author (works, but defaults to username of comp, not initials), and Scale (pulls scale from first drawing placed only).

 

Author uses the <DESIGNER> tag, and the Scale uses a custom tag in the iProperties menu.  Company uses Inv. 2012.

 

Thanks in advance for the help.

3 REPLIES 3
Message 2 of 4
jdkriek
in reply to: elixin77

The CAD Admin should have had users configure thier Tools > Application Options > General Tab > "Username" to be the user's intials. Then when a new file is created the Author and Designer iProperties are automaticly filled in correctly. Then it's filled out on the title block automaticly via <AUTHOR> or <DESIGNER> variables inserted from Drawing Properties.

 

username.PNG

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 4
matt_jlt
in reply to: jdkriek

If you want your scale iproperty fille out automatically from the first view placed you can use iLogic / VBA / Addin.

 

For iLogic you can use this:

' Define Document & First Sheet
	Dim oDrg As DrawingDocument = ThisDrawing.Document
	Dim oSheet As Sheet = oDrg.Sheets.Item(1)
	
' Check if there are any views on the sheet
	If oSheet.DrawingViews.Count = 0 Then
		Exit Sub
	End If

' Get the first view on the sheet
	Dim oView As DrawingView = oSheet.DrawingViews.Item(1)

' Update Scale iProperty
	iProperties.Value("Custom", "Scale") = oView.ScaleString

' Update Drawing to reflect changes
	InventorVb.DocumentUpdate()

 

Just set the rule to run every time the drawing is saved

Inventor > Manage Tab > iLogic Panel > Event Triggers button

 

Regards, Matt.

 

If this solves your problem, please accept this as the solution.

Message 4 of 4
ntreb
in reply to: matt_jlt

Hi Matt,

How do you stop the code from overwriting a value (back to the scale of the first view inserted) if you have changed the scale manually?

 

Is there a code which reads whether a field has had a value inserted manually?

 

I'm sure there is other basic code which could achieve the same result, but I am new to this coding game so not too sure.

 

Cheers,

Nick

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report