Inventor Customization

Reply
Member
elixin77
Posts: 3
Registered: ‎06-15-2012
Message 1 of 4 (395 Views)
Accepted Solution

Autofill Scale?

395 Views, 3 Replies
06-15-2012 07:07 AM

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.

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

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.

*Expert Elite*
jdkriek
Posts: 545
Registered: ‎03-29-2007
Message 2 of 4 (379 Views)

Re: Autofill Scale?

06-18-2012 11:38 AM 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

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below
Mentor
matt_jlt
Posts: 218
Registered: ‎07-28-2007
Message 3 of 4 (366 Views)

Re: Autofill Scale?

06-18-2012 07:53 PM 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.

New Member
ntreb
Posts: 1
Registered: ‎11-15-2012
Message 4 of 4 (257 Views)

Re: Autofill Scale?

11-22-2012 12:59 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!