Inventor Customization

Inventor Customization

Reply
*Bob S.
Message 1 of 6 (309 Views)

API revision question for my own edification

309 Views, 5 Replies
08-05-2008 10:04 AM
I had an addin I wrote that has a rename drawing view function,
and I had previously added a DrawView.ShowName = true statement
to turn on the view label if it was off.

Upon running it recently on IV2009, I git a run-time error 80004005
Method '~' of object '~' failed, and upon tracking this down I found
that according to the docs for IV2009, ShowName has been removed
(and replaced with ShowLabel).

But, the interesting thing which I'd like to know, is why does the
label still get turned on even when I was still calling ShowName?
Apparently ShowName is still valid because after changing it to
ShowLabel, I still am getting the error and now I am thinking it
has to do with trying to end a transaction instead.

Bob S.
*Brian Ekins \(Autodesk\)
Message 2 of 6 (309 Views)

Re: API revision question for my own edification

08-19-2008 06:50 PM in reply to: *Bob S.
ShowName wasn't removed but has been hidden, along with ShowScale. Even
though they're hidden they can still be used and now have the same effect as
calling the new ShowLabel property. This is in reaction to a change in
Inventor. Previously to Inventor 2009 the scale and name were seperate and
you could control the display of them independently. Inventor 2009 now
supports a general and more powerful view labeling mechanism. The view
label is text that can contain fields for the view name and scale, plus
other values just like you can use in other text notes (iProperties, etc.).
The API had to react to this change in Inventor.

Earlier code that used these properties will still work but you might not
get quite the results you expected. For example, if you program turns off
the scale but expects the name to still be there, since the name will get
turned off when you turn the scale off since they're both part of the new
single view label.

As you suspected the problem must be from something else.
--
Brian Ekins
Autodesk Inventor API
Mentor
Mike_Maenpaa
Posts: 183
Registered: ‎09-23-2008
Message 3 of 6 (272 Views)

Re: API revision question for my own edification

01-04-2011 01:18 PM in reply to: *Brian Ekins \(Autodesk\)

*Brian Ekins \(Autodesk\) wrote:
ShowName wasn't removed but has been hidden, along with ShowScale. Even
though they're hidden they can still be used and now have the same effect as
calling the new ShowLabel property. This is in reaction to a change in
Inventor. Previously to Inventor 2009 the scale and name were seperate and
you could control the display of them independently. Inventor 2009 now
supports a general and more powerful view labeling mechanism. The view
label is text that can contain fields for the view name and scale, plus
other values just like you can use in other text notes (iProperties, etc.).
The API had to react to this change in Inventor.

Earlier code that used these properties will still work but you might not
get quite the results you expected. For example, if you program turns off
the scale but expects the name to still be there, since the name will get
turned off when you turn the scale off since they're both part of the new
single view label.

As you suspected the problem must be from something else.
--
Brian Ekins
Autodesk Inventor API

Can you show me an example of how to do this?

I want to leave the View Name shown, but turn the Scale off.

 

Thanks!

 

Mike

 

Mentor
Mike_Maenpaa
Posts: 183
Registered: ‎09-23-2008
Message 4 of 6 (176 Views)

Re: API revision question for my own edification

04-05-2011 09:00 AM in reply to: Mike_Maenpaa

I have already adjusted the View Annotation style, but it would be nice to be able to do this with a click of a button instead of having to right-click the label and delete the scale on every view.

Anyone have any idea on this?

 

Thanks!

 

Mike

Employee
yuhanzhang
Posts: 474
Registered: ‎01-06-2009
Message 5 of 6 (163 Views)

Re: API revision question for my own edification

04-10-2011 10:55 PM in reply to: Mike_Maenpaa

If there is no exceptional view that you can use below VBA to do this:

Sub ShowViewName()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oView As DrawingView
    For Each oView In Me.Sheets(1).DrawingViews
        oView.Label.FormattedText = "<DrawingViewName/>"
        oView.ShowLabel = True
    Next
End Sub

 



Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.

Mentor
Mike_Maenpaa
Posts: 183
Registered: ‎09-23-2008
Message 6 of 6 (156 Views)

Re: API revision question for my own edification

04-11-2011 06:13 AM in reply to: yuhanzhang

Thanks Rocky, but I've altready been able to do what you have shown.

I want to turn off the View Scale.

 

Thanks!

 

Mike

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.