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: 

iLogic - Get view type

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
3780 Views, 5 Replies

iLogic - Get view type

Anonymous
Not applicable

Could find this anywhere, Is there a way to get the "view type" of a view using iLogic? for example;

 

-detail view

-section view

-exploded view

 

Or any way to differenciate between the types of views?

 

I'm trying to write a rule that renames all detail and section views in a drawing in Alphabetical order. A,B,C,D..

 

Cheers for any help,

Ben

0 Likes

iLogic - Get view type

Could find this anywhere, Is there a way to get the "view type" of a view using iLogic? for example;

 

-detail view

-section view

-exploded view

 

Or any way to differenciate between the types of views?

 

I'm trying to write a rule that renames all detail and section views in a drawing in Alphabetical order. A,B,C,D..

 

Cheers for any help,

Ben

Tags (3)
5 REPLIES 5
Message 2 of 6
cwhetten
in reply to: Anonymous

cwhetten
Advisor
Advisor
Accepted solution

Do you know how to access the view object?  Because if you do, getting the view type is as simple as DrawingView.ViewType.  This will return a DrawingViewTypeEnum depending on which type it is.  The list of enums are as follows (from the 2014 API help documentation):

 

Drawing View Type Enums.PNG

 

If you don't know how to access the view object, post back with an example of your code where you need to find the view type.

 

Cameron Whetten
Inventor 2014

Do you know how to access the view object?  Because if you do, getting the view type is as simple as DrawingView.ViewType.  This will return a DrawingViewTypeEnum depending on which type it is.  The list of enums are as follows (from the 2014 API help documentation):

 

Drawing View Type Enums.PNG

 

If you don't know how to access the view object, post back with an example of your code where you need to find the view type.

 

Cameron Whetten
Inventor 2014

Message 3 of 6
pcrawley
in reply to: cwhetten

pcrawley
Advisor
Advisor

Message 4 of 6
Anonymous
in reply to: cwhetten

Anonymous
Not applicable

Thanks for the replies,

 

@Cameron, thanks I do know how to access the view object. Would you be able to provide a link to the 2014 API help documentation though?

 

Cheers,

Ben

0 Likes

Thanks for the replies,

 

@Cameron, thanks I do know how to access the view object. Would you be able to provide a link to the 2014 API help documentation though?

 

Cheers,

Ben

Message 5 of 6
pcrawley
in reply to: Anonymous

pcrawley
Advisor
Advisor

18-12-2013 2-05-47 p-m-.jpg

Peter
0 Likes

18-12-2013 2-05-47 p-m-.jpg

Peter
Message 6 of 6
Anonymous
in reply to: pcrawley

Anonymous
Not applicable

Thanks Peter!

 

by the way for anyone reading this, here's my working code below (scavenged from other forum posts too),

 

It reformats all view labels in a drawing and sequentially renames the detail and section views, in alphabetical order!!!!

 

 

Dim oDoc As DrawingDocument:  oDoc = ThisDoc.Document
oModelDoc = ThisDoc.ModelDocument

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

ViewLetter = New String(){"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","W","Y","Z"}
Dim ViewCount = 0

oSheets = oDoc.Sheets

Dim view_asso_draft = 10506
Dim view_auxillary = 10499
Dim view_custom = 10498
Dim view_default = 10497
Dim view_detail = 10502
Dim view_draft = 10505
Dim view_OLE = 10500
Dim view_overlay = 10507
Dim view_projected = 10504
Dim view_section = 10503
Dim view_standard = 10501

For Each oSheet In oSheets
oViews = oSheet.DrawingViews
For Each oView In oViews
' Set a reference to the mass properties object.
'Dim oMassProps As MassProperties = oModelDoc.ComponentDefinition.MassProperties

' Set the accuracy to medium.
'oMassProps.Accuracy = MassPropertiesAccuracyEnum.k_Low
'Dim M As Double = oMassProps.Mass

'Set label as visible
oView.ShowLabel = True

'Create the label strings
oView_line1_standard = "<Br/><StyleOverride Underline='True'><DrawingViewName/> VIEW</StyleOverride>"
oView_line1_detail = "<Br/><StyleOverride Underline='True'>DETAIL <DrawingViewName/></StyleOverride>"
oView_line1_section = "<Br/><StyleOverride Underline='True'>SECTION: <DrawingViewName/>-<DrawingViewName/></StyleOverride>"
oView_line2 = "<Br/><StyleOverride Underline='True'>DESC: <Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
'oStringMass = "<Br/><StyleOverride Underline='True'>EST. UNIT MASS: "& FormatNumber(M, 0)&" kg</StyleOverride>"
oView_line3 = "<Br/><StyleOverride Underline='True'>SCALE <DrawingViewScale/></StyleOverride>"

'check view types
If oView.ViewType = view_detail Then
'if detail view display this label
oView.Label.FormattedText = oView_line1_detail & oView_line3
'rename as the next character in the ViewCount array
oView.Name = ViewLetter(ViewCount)
ViewCount = ViewCount + 1

Else If oView.ViewType = view_section Then
'if section view display this label
oView.Label.FormattedText = oView_line1_section & oView_line3
'rename as the next character in the ViewCount array
oView.Name = ViewLetter(ViewCount)
ViewCount = ViewCount + 1

Else
'else display this label as default
oView.Label.FormattedText = oView_line1_standard & oView_line2 & oView_line3
End If
Next
Next

Thanks for your help guys,

Ben

Thanks Peter!

 

by the way for anyone reading this, here's my working code below (scavenged from other forum posts too),

 

It reformats all view labels in a drawing and sequentially renames the detail and section views, in alphabetical order!!!!

 

 

Dim oDoc As DrawingDocument:  oDoc = ThisDoc.Document
oModelDoc = ThisDoc.ModelDocument

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

ViewLetter = New String(){"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","W","Y","Z"}
Dim ViewCount = 0

oSheets = oDoc.Sheets

Dim view_asso_draft = 10506
Dim view_auxillary = 10499
Dim view_custom = 10498
Dim view_default = 10497
Dim view_detail = 10502
Dim view_draft = 10505
Dim view_OLE = 10500
Dim view_overlay = 10507
Dim view_projected = 10504
Dim view_section = 10503
Dim view_standard = 10501

For Each oSheet In oSheets
oViews = oSheet.DrawingViews
For Each oView In oViews
' Set a reference to the mass properties object.
'Dim oMassProps As MassProperties = oModelDoc.ComponentDefinition.MassProperties

' Set the accuracy to medium.
'oMassProps.Accuracy = MassPropertiesAccuracyEnum.k_Low
'Dim M As Double = oMassProps.Mass

'Set label as visible
oView.ShowLabel = True

'Create the label strings
oView_line1_standard = "<Br/><StyleOverride Underline='True'><DrawingViewName/> VIEW</StyleOverride>"
oView_line1_detail = "<Br/><StyleOverride Underline='True'>DETAIL <DrawingViewName/></StyleOverride>"
oView_line1_section = "<Br/><StyleOverride Underline='True'>SECTION: <DrawingViewName/>-<DrawingViewName/></StyleOverride>"
oView_line2 = "<Br/><StyleOverride Underline='True'>DESC: <Property Document='model' PropertySet='Design Tracking Properties' Property='Part Number' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='5'>PART NUMBER</Property></StyleOverride>"
'oStringMass = "<Br/><StyleOverride Underline='True'>EST. UNIT MASS: "& FormatNumber(M, 0)&" kg</StyleOverride>"
oView_line3 = "<Br/><StyleOverride Underline='True'>SCALE <DrawingViewScale/></StyleOverride>"

'check view types
If oView.ViewType = view_detail Then
'if detail view display this label
oView.Label.FormattedText = oView_line1_detail & oView_line3
'rename as the next character in the ViewCount array
oView.Name = ViewLetter(ViewCount)
ViewCount = ViewCount + 1

Else If oView.ViewType = view_section Then
'if section view display this label
oView.Label.FormattedText = oView_line1_section & oView_line3
'rename as the next character in the ViewCount array
oView.Name = ViewLetter(ViewCount)
ViewCount = ViewCount + 1

Else
'else display this label as default
oView.Label.FormattedText = oView_line1_standard & oView_line2 & oView_line3
End If
Next
Next

Thanks for your help guys,

Ben

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

Post to forums  

Autodesk Design & Make Report