Inventor General Discussion

Inventor General Discussion

Reply
Distinguished Contributor
drguitarum2005
Posts: 197
Registered: ‎10-08-2012
Message 1 of 7 (416 Views)
Accepted Solution

Pulling iProperties from drawing sheets

416 Views, 6 Replies
01-03-2013 02:52 PM

Is there a way, in my drawing template, to set one field as "Part Number iProperty from parent assembly on sheet 1 base view"? I want every single sheet in my .idw to reference the same "Part Number" iProperty from the assembly in the base view of sheet 1. Thanks!

Hi there,

 

try this out. I use it to show the partnumber on another sheet that includes the parts list.

it actually writes the part number of the first placed model into the custom properties. (so you can use it in a titleblock)

you need to name a text parameter Part_nr_sheet1

 

' exit rule if no part or assembly is in the drawing yet

If (ThisDrawing.ModelDocument Is Nothing) Then Return

 

'get the filename of the doc the drawing points to

modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

 

Part_nr_sheet1 = iProperties.Value(modelName, "Project", "Part number")

'fires the part nr as shown in the first sheet so it can be used in the partslist sheet titleblock

'without having a drawing view on that sheet

Dim propertyName1 As String = "Part nr list"

oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Try

oProp = oCustomPropertySet.Item(propertyName1)

Catch

oCustomPropertySet.Add("", propertyName1)

End Try

iProperties.Value("Custom", "Part nr list") = Part_nr_sheet1

iLogicVb.UpdateWhenDone = True

 

 

hope this helps you out!

cheers,

Jachin

Active Member
JachinBr
Posts: 9
Registered: ‎01-04-2013
Message 2 of 7 (400 Views)

Re: Pulling iProperties from drawing sheets

01-04-2013 07:02 AM in reply to: drguitarum2005

Hi there,

 

try this out. I use it to show the partnumber on another sheet that includes the parts list.

it actually writes the part number of the first placed model into the custom properties. (so you can use it in a titleblock)

you need to name a text parameter Part_nr_sheet1

 

' exit rule if no part or assembly is in the drawing yet

If (ThisDrawing.ModelDocument Is Nothing) Then Return

 

'get the filename of the doc the drawing points to

modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)

 

Part_nr_sheet1 = iProperties.Value(modelName, "Project", "Part number")

'fires the part nr as shown in the first sheet so it can be used in the partslist sheet titleblock

'without having a drawing view on that sheet

Dim propertyName1 As String = "Part nr list"

oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Try

oProp = oCustomPropertySet.Item(propertyName1)

Catch

oCustomPropertySet.Add("", propertyName1)

End Try

iProperties.Value("Custom", "Part nr list") = Part_nr_sheet1

iLogicVb.UpdateWhenDone = True

 

 

hope this helps you out!

cheers,

Jachin

Contributor
devonjohnson
Posts: 15
Registered: ‎07-26-2012
Message 3 of 7 (277 Views)

Re: Pulling iProperties from drawing sheets

05-28-2013 07:07 PM in reply to: JachinBr

Hi there,

 

Thanks so much for this rule, I've added it to my drawing template and it works great for iam and ipt files but it brings up an error for presentation files.

 

"Object reference not set to an instance of an object."

 

Can the rule be tweaked to suit all files?   I'm trying to amend it myself but not luck so far...

 

Thanks for your help.

Thanks,
Devon Johnson

Inventor 2013
rki
Active Member
rki
Posts: 9
Registered: ‎09-02-2013
Message 4 of 7 (143 Views)

Re: Pulling iProperties from drawing sheets

05-14-2014 05:42 AM in reply to: devonjohnson

Hi Devon,

 

Did you ever get this working? I have the exact same problem now:-(

 

Br.

Rasmus

Contributor
devonjohnson
Posts: 15
Registered: ‎07-26-2012
Message 5 of 7 (122 Views)

Re: Pulling iProperties from drawing sheets

05-14-2014 07:39 PM in reply to: rki

Hi,

 

Yes I did get it to work, here is the code I used. Hope it helps!

 

If (ThisDrawing.ModelDocument Is Nothing) Then Return

Dim presDoc As Document 

Dim propertyName1 As String = "Part nr list"

presDoc = ThisDrawing.ModelDocument

Part_nr_sheet1 = presDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value

oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") 
 
Try

oProp = oCustomPropertySet.Item(propertyName1)

Catch

oCustomPropertySet.Add("", propertyName1)

End Try

iProperties.Value("Custom", "Part nr list") = Part_nr_sheet1

 
iLogicVb.UpdateWhenDone = True
 
Thanks,
Devon Johnson

Inventor 2013
rki
Active Member
rki
Posts: 9
Registered: ‎09-02-2013
Message 6 of 7 (109 Views)

Re: Pulling iProperties from drawing sheets

05-15-2014 12:59 PM in reply to: devonjohnson

Hi Devon,

 

Thanks, this works. Just not the way I intended.

I need the I ipropperties from the .iam not the .ipn.

Essentially I just need the error message to dissapear. (see attachment.) then I will use the good old copy model propperties for the .ipn since this takes the ipropperties directly from the .iam ie. it skips the .ipn ipropperties.

Any ideas?

 

Br.

Rasmus

 

rki
Active Member
rki
Posts: 9
Registered: ‎09-02-2013
Message 7 of 7 (84 Views)

Re: Pulling iProperties from drawing sheets

05-20-2014 06:44 AM in reply to: rki

Hi again Devon,

 

I solved the problem, and smarter than I could have ever hoped.

 

Instead of moving data from one file to the other I made my .idw templete grab all the data from the source ie. .ipt or .iam (like it also grabs the geometry)

 

This removes the need of ever copying propperties from one file to another. 

Really only posting this because I am so releaved and had to share it :-)

 

Br.

Rasmus

 

 

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.