Inventor Customization

Inventor Customization

Reply
Active Contributor
shirazbj
Posts: 46
Registered: ‎02-25-2007
Message 1 of 7 (415 Views)
Accepted Solution

how to know if a view is baseview with vb.net?

415 Views, 6 Replies
02-05-2013 03:01 AM

Hi,

 

While loop through all Views in a sheet, I can use oView.ScaleFromBase to know if the scale of the view is changed from Base-View. Like this:

 

  For Each oView In oViews
                If oView.ScaleFromBase = False Then
'This view's scale is different from that of the Base-View

 But I can't tell in this way if it is a Base-View or views with different view scale.

 

There is a oView.ViewType,  I tried this

Dim mytype As String
mytype = oView.ViewType

 

for Base-View, mytype=10501

for other-view with different scale, mytype=10504

 

Is there other property I could use? Can't work out how to get the View Type Name.

 

Thanks for help.

 

Regards,

 

Peter

You can check this way:

 

For each oView in oViews
If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then
Debug.Print("This is a base view")
Else
Debug.Print("This is not a base view")
     End If
Next

 Or you can check the oView.Aligned property but this will also return false if the alignment has been broken from the base view.

ADN Support Specialist
Vladimir.Ananyev
Posts: 531
Registered: ‎08-14-2012
Message 2 of 7 (410 Views)

Re: how to know if a view is baseview with vb.net?

02-05-2013 07:00 AM in reply to: shirazbj

You may check oView.ParentView property.

For base view it returns Nothing.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Active Contributor
shirazbj
Posts: 46
Registered: ‎02-25-2007
Message 3 of 7 (398 Views)

Re: how to know if a view is baseview with vb.net?

02-05-2013 04:47 PM in reply to: Vladimir.Ananyev

Hi Vladimir,

 

I tried this, but both baseview and view whose scale if different from baseview return a Nothing.

 

Regards,

 

Peter

 

            Dim myView As DrawingView

            For Each oView In oViews
                If oView.ScaleFromBase = False Then

                    myView = oView.ParentView

                    If myView Is Nothing Then
                        MsgBox("nothing")
                    Else
                        MsgBox("something")
                    end if
                 end if
             next  

 

Employee
yuhanzhang
Posts: 480
Registered: ‎01-06-2009
Message 4 of 7 (389 Views)

Re: how to know if a view is baseview with vb.net?

02-06-2013 01:48 AM in reply to: shirazbj

Can you attach the data that you see the problem? Or double check the drawing view which has different scale from its parent view does have a parent view or not?



Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.

Active Contributor
Robert..F
Posts: 49
Registered: ‎07-09-2012
Message 5 of 7 (379 Views)

Re: how to know if a view is baseview with vb.net?

02-07-2013 07:13 AM in reply to: shirazbj

You can check this way:

 

For each oView in oViews
     If oView.ViewType = Inventor.DrawingViewTypeEnum.kStandardDrawingViewType Then
          Debug.Print("This is a base view")
     Else
          Debug.Print("This is not a base view")
     End If
Next

 Or you can check the oView.Aligned property but this will also return false if the alignment has been broken from the base view.

Active Contributor
shirazbj
Posts: 46
Registered: ‎02-25-2007
Message 6 of 7 (365 Views)

Re: how to know if a view is baseview with vb.net?

02-08-2013 03:44 PM in reply to: yuhanzhang

Hi Rocky,

 

I just made a cube and generated a base view, a top view,a right view and an iso view. Then I change the view scale of the iso view.

 

Then I want the code to tell me which one's scale is changed and it is not a base view.

 

Peter

Active Contributor
shirazbj
Posts: 46
Registered: ‎02-25-2007
Message 7 of 7 (363 Views)

Re: how to know if a view is baseview with vb.net?

02-08-2013 03:45 PM in reply to: Robert..F

Hi Robert,

 

It's works for me. thank you very much.

 

Regards,

 

Peter

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.