Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawing Properties

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
schae235
598 Views, 7 Replies

Drawing Properties

We have a template that we use for both assemblies and parts and I was wondering if it is possible to create some iLogic code that would change the title block depending on if the drawing was of a part or assembly. 

 

What I want to happen is if the drawing is of an assembly I want the "Material" box to fill in with N/A where as if the drawing is a part I want it to pull that information from the iproperties of the part.  Any help would be greatly appreciated, Thanks in advance.

INV 2012 SP1
Windows 7 64 Bit
ATI FirePro V5800
14.0 GB RAM
7 REPLIES 7
Message 2 of 8

Hi schae235,

 

Here's a sample rule to be run in a drawing. This could use some error checking to look for cases where more than one referenced file is present on the same sheet, but it should get you started. Currently I have it writing to the Comments iproperty, expecting that the title block would be set up to read that iproperty, but you can change that as needed to direct it to any standard or custom iproperty that your title block is set up to read from.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

'define the drawing doc
oDrawDoc = ThisApplication.ActiveDocument
'define the drawing sheet
oSheet = oDrawDoc.ActiveSheet
'look at each drawing view
For Each oView In oSheet.DrawingViews
	If oView.ReferencedFile.DocumentType = kAssemblyDocumentObject Then
	iProperties.Value("Summary", "Comments" )  = "N/A"
	else If oView.ReferencedFile.DocumentType = kPartDocumentObject Then
	Dim oPartModel As PartDocument
	oPartModel = oView.ReferencedFile.ReferencedDocument
	oMassPropsets = oPartModel.PropertySets
	oMassPropset = oMassPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}") 
	CurrentMaterial = oMassPropset.Item("Material").Value 
	iProperties.Value("Summary", "Comments" ) = CurrentMaterial
	else
	end if
Next
iLogicVb.UpdateWhenDone = True

 

Message 3 of 8

Curtis_Waguespack

 

I added your code to out Assembly template (Or tried to) and I keep getting an error.

 

"Public member 'ActiveSheet' on type '_DocumentClass' not found"

 

W/ More info:

System.MissingMemberException: Public member 'ActiveSheet' on type '_DocumentClass' not found.

at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)

at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)

at LmiRuleScript.Main()

at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)

at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

 

Now, I can't read that but I think the error is in the

oMassPropset = oMassPropsets.Item("{xxxxx}") line

 

I have dabbled in iLogic and for the most part understand the code except for this line.  Would you be able to go into some kind of explination as to the string that you used in that line? 

 

Also I am sorry to get back to this so late, some more pressing concerns came up and I had to put this on hold till now.

INV 2012 SP1
Windows 7 64 Bit
ATI FirePro V5800
14.0 GB RAM
Message 4 of 8

Hi schae235,

 

This ilogic rule needs to be run from a Drawing template, rather than an assembly template.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Message 5 of 8

Oh yes.  Sorry I wasn't thinking when I typed that I did place it in the drawing template.  Smiley Embarassed

INV 2012 SP1
Windows 7 64 Bit
ATI FirePro V5800
14.0 GB RAM
Message 6 of 8

Hi schae235,

 

Here are a couple of files. The drawing file has the rule setup in it. If you run the rule in this file do you have an issue? If so, what version if Inventor are you using?

 

the line:

oMassPropset = oMassPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}")

points to the mass properties of the model file. If that line is causing you issue, there might be a better way to reference the Material property using kMaterialDesignTrackingProperties, but that's just off the top of my head.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

Message 7 of 8
schae235
in reply to: schae235

The drawing template works, Also I am using Inventor 2012.  I am going to see what I can do to get this to play well with our drawing templates.  I'll keep you posted.  Thanks

INV 2012 SP1
Windows 7 64 Bit
ATI FirePro V5800
14.0 GB RAM
Message 8 of 8
schae235
in reply to: schae235

I don't know what it was but when I copied the code from your drawing template into our drawing template it worked.  Thank you so much!

INV 2012 SP1
Windows 7 64 Bit
ATI FirePro V5800
14.0 GB RAM

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

Post to forums  

Autodesk Design & Make Report