Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Reference Drawing Sheet Number with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Does anyone know how to reference the drawign sheet number using iLogic? I see on the snippets on the side a way to reference the sheet name, but I only want the number. To get the name it is ActiveSheet.Name, but ActiveSheet.Number does not work. Getting the name give something like ASSM:1, so if there was a way to take that and subtract the colon and everything before it that would work also. I am not a programmer, I've just taked some programs I found online and modified them a little to do what I want to do, but this is holding me back a bit.
Overall, I'm trying to modify the drawing view label to have a project number, referenced from the drawign iProperties, a view label, and sheet number, and then save that info in an iproperty of the part, and then reference that in the BOM so it automatically labels all of the views and fills out a column of the BOM to reference which page and view to find the parts of the assembly. I have everything working except for the sheet number.
I would greatly appreciate any help.
Thanks,
Jeremy
Re: Reference Drawing Sheet Number with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi jestes,
Here is an example:
Dim oSheet As Sheet Dim SheetNumber as String i = 1 For Each oSheet In ThisApplication.ActiveDocument.Sheets SheetNumber = Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1) MessageBox.Show(SheetNumber, oSheet.Name) i=1+1 Next
Or something like this to get the active sheet only:
oDoc = ThisDoc.Document
SheetNumber = Mid(oDoc.ActiveSheet.Name, InStr(1, oDoc.ActiveSheet.Name, ":") + 1)
MessageBox.Show(SheetNumber, oDoc.ActiveSheet.Name)
Keep in mind you might have better luck searching and asking questions of this type on the Inventor Customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Cu
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Reference Drawing Sheet Number with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Curtis, that worked great. I think this will help us out a lot.
Jeremy
Re: Reference Drawing Sheet Number with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hey Curis, I found a problem in my code I was hoping you could help me with again. For some reason what I'm doing does not work with any parts made by the frame generator. Everything else I've tried seems to work well. What I want is to get a project number-view label-sheet number sent to the Status iPropertie of the part or assembly that is inside the view. Then I can use the Status iProperty inside my view label and the BOM. I'll attach my code below. If you wouldn't mind looking at it I would appreciate it. Thanks a lot, I appreciate the help.
Jeremy
'start of ilogic codeDim oDoc As DrawingDocument: oDoc = ThisDoc.Document Dim oSheets As Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView Dim SheetNumber As String i =1 oSheets = oDoc.Sheets For Each oSheet In oSheets oViews = oSheet.DrawingViews For Each oView In oViews 'capture the current view label
ViewLabel = oView.Name oModelName = _ oView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName Try SheetNumber =Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1) i=1+1 iProperties.Value(oModelName, "Status", "Status") = _
iProperties.Value("Project", "Project")+"-"+ViewLabel+SheetNumber 'Send view label items to models Status iProperty
'Use Status iProperty for view label
Catch 'do nothing if error
End Try 'End If
Next Next 'end of ilogic code
Re: Reference Drawing Sheet Number with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi jestes,
The problem is with the display name of the Frame Generator parts (and many other Content Center parts). Basically Autodesk is setting the display name as an override in their Content Center tables, and therefore your code was reading in something such as ANSI 2x2x3_16 00000009 rather then ANSI 2x2x3_16 00000009.ipt.
Adding a line of code to reset the display name to nothing, allows the part to return back to the default display name.
oView.ReferencedDocumentDescriptor.ReferencedDocum
This is the same as doing this:
Here's your updated rule.
'start of ilogic code Dim oDoc As DrawingDocument: oDoc = ThisDoc.Document Dim oSheets As Sheets Dim oSheet As Sheet Dim oViews As DrawingViews Dim oView As DrawingView Dim SheetNumber As String i =1 oSheets = oDoc.Sheets For Each oSheet In oSheets oViews = oSheet.DrawingViews For Each oView In oViews 'capture the current view label ViewLabel = oView.Name 'reset the display name oView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName = "" 'get the display name oModelName = _ oView.ReferencedDocumentDescriptor.ReferencedDocum ent.DisplayName Try 'get the sheet number SheetNumber =Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1) i=1+1 iProperties.Value(oModelName, "Status", "Status") = _ iProperties.Value("Project", "Project")+"-"+ViewLabel+SheetNumber 'Send view label items to models Status iProperty 'Use Status iProperty for view label Catch 'do nothing if error End Try Next Next
'end of ilogic code
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Reference Drawing Sheet Number with iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Curtis,
That fixed that, but I did run into a couple more issues. Is there any way to make it work with iParts? I get an error if there is an iPart on the sheet. I might have to use a different iProperty other than Status to work with iParts because I don't see that as being on that you can update in the iPart table. If this is not doable or very difficult I can just update these views manually. It seems to still work for the rest of the views.
Also, for some reason it works fine on 2 of the machines I tried it on, but it won't work on one of our other employees machines. It doesn't give any errors, and as far as I know it runs the program, but it just doesn't do anything. No changes to the properties. Any idea why it would be different on one machine? I have the rule saved in a template, so we're both opening the exact same thing and both on Inventor 2013. I don't think he has the newest service pack installed, so that might be it.
Thanks for the help, I really appreciate it.
Jeremy
