Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change Design View in IDW

9 REPLIES 9
Reply
Message 1 of 10
ADNpati
697 Views, 9 Replies

Change Design View in IDW

Hi,

 

Change Design View in IDW.

 

Followupfrom a thread from Years ago..

 

Lookin got get designViewrep name in Drawing FIle.

 

Sub DesignViewRep()

    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oDrawingView As DrawingView
    Set oDrawingView = ThisApplication.CommandManager.Pick(kDrawingViewFilter, "Select a drawing view")
    
    MsgBox oDrawingView.ActiveDesignViewRepresentation

End Sub

Above macro from Daniel is not working.. please fing avi file attached.

 

hope we will get some soloution for a simple and small issue.

 

 

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------
9 REPLIES 9
Message 2 of 10
djreesing
in reply to: ADNpati

What Inventor version are you using? I tested the code with Inventor 2013. See below for a section from the programming help. I looks like it's in the API since Inventor 11.

 

What is the problem with the code? do you get a runtime error or just an empty msgbox?

 

  

DrawingView.ActiveDesignViewRepresentation Property

Parent Object: DrawingView

Description

Property that returns the name of the active Design View Representation for a drawing view of an assembly. This property returns a null string for drawing views of parts & presentations and in the case where the model (assembly) is unresolved.

Syntax

DrawingView.ActiveDesignViewRepresentation() As String

Version

Introduced in Inventor version 11

Message 3 of 10
ADNpati
in reply to: djreesing

Hii..

 

It is just retuning an empty MsgBox. If you have any File Transfer (large file) I can send you debug video.

 

Just an Empty Msgbox. Nothing else.No errors.

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------
Message 4 of 10
djreesing
in reply to: ADNpati

Are you selecting an assembly view?

 

This line in the help will explain the empty message box: "This property returns a null string for drawing views of parts & presentations and in the case where the model (assembly) is unresolved."

Message 5 of 10
ADNpati
in reply to: djreesing

 

That is a clean and simple Assembly, And I am selecting the viewas well.

 

Is that working with oyu?? Iam Using INV 2013.

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------
Message 6 of 10
djreesing
in reply to: ADNpati

Hmm last week it worked, but I now seem to get the same behavior you mention. Just an empty msgbox.

 

I will try to find out what the problem is.

 

Daniël

Message 7 of 10
djreesing
in reply to: ADNpati

Ok, here's what I've found out.

 

When I place a view with a design view other than Master selected, the code works. If I select another design view other than master, the code also works. But if I select the master design view, the ActiveDesignViewRepresentation property returns an emptry string. Even more strange, when I now select another design view (which previously worked), the string is still empty!

 

Could you please check if you can reproduce this?

Message 8 of 10
ADNpati
in reply to: djreesing

ActiveDesignViewRepresentation  property works if and only Associative box is checked (marked) when placing the view on the drawing sheet.

 

But I am looking to get the name of the view even if assocative is not selected.

 

Even if there is a custom view (or Default View), without associative checked, msgbox result a null value.

 

May be somebody should fix or clarify.

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------
Message 9 of 10
xiaodong_liang
in reply to: ADNpati

Hi,

 

this is a known issue which has been logged: ActiveDesignViewRepresentation  should return the corresponding view name no matter the view associative or not.

Message 10 of 10
Crstiano
in reply to: xiaodong_liang

Hi Xiaodong,

I have similar problem... my ActiveDesignViewRepresentation always returns = ""

 

Exist a correct way for control and change the DesignViewRepresentation of the SubAssembly in the Assembly?

 

I try in IV2014, if I use:

 

Call oOcc.SetDesignViewRepresentation ("OffZones")

 The software crash !!!!

 

If I use:

Dim oRepMan As RepresentationsManager
Set oRepMan = oOcc.Definition.RepresentationsManager
Dim oDVR As DesignViewRepresentation
Set oDVR = oRepMan.DesignViewRepresentations.Item("OffZones")
Call oDVR.Activate

 Don't show effects.... Smiley Frustrated

 

And another set: How define IsAssociativeToDesignViewRepresentation in this change ??

 

Thanks in advance

 

Cristiano Oliveira
Developer Addins | Consultant CAD/PLM | CAD Manager
https://www.ConsultCAD.com/


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

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

Post to forums  

Autodesk Design & Make Report