Issues of 'Primary' Part Design View (doubling and unexpected DesignViewType)

Issues of 'Primary' Part Design View (doubling and unexpected DesignViewType)

Maxim-CADman77
Advisor Advisor
531 Views
8 Replies
Message 1 of 9

Issues of 'Primary' Part Design View (doubling and unexpected DesignViewType)

Maxim-CADman77
Advisor
Advisor

I feel a bit puzzled with Design Views of part-model.
For example, when I create a new IPT using default template it gets five entries inside the 'View' "folder" of Model browser.
But when I try to print out names and types (DesignViewTypeEnum) of all Design Views in cycle with iLogic-rule like this:

 

Dim repMgr = ThisDoc.Document.ComponentDefinition.RepresentationsManager

logger.info("DVR-count: " & repMgr.DesignViewRepresentations.Count)

For each dvr In repMgr.DesignViewRepresentations
	logger.info(dvr.Name & vbTab & vbTab & repMgr.ActiveDesignViewRepresentation.DesignViewType)
Next

 

... I get six view names (including TWO "[Primary]") and all Enum-s are 57348 (kTransientDesignViewType) while my expectation was to get at least one 'kPrimaryDesignViewType' (57345) :

MaximCADman77_0-1699636836423.png


What I'm missing?

PS:
The described was just reproduced in Inventor 2024.2.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
532 Views
8 Replies
Replies (8)
Message 2 of 9

Maxim-CADman77
Advisor
Advisor

Here is an updated code:

Dim repMgr = ThisDoc.Document.ComponentDefinition.RepresentationsManager

logger.info("DVR-count: " & repMgr.DesignViewRepresentations.Count)

Dim i As Integer
For each dvr In repMgr.DesignViewRepresentations
	i +=1
	Dim DVT = [Enum].GetName(GetType(DesignViewTypeEnum), repMgr.ActiveDesignViewRepresentation.DesignViewType)
	logger.info(dvr.Name + vbTab + vbTab + DVT + vbTab + vbTab + If(dvr Is repMgr.ActiveDesignViewRepresentation, "!!!", "-"))
Next

Which shows that active Primary View is the last in Collection:

MaximCADman77_0-1699689637178.png

The context of this question see here.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 3 of 9

WCrihfield
Mentor
Mentor

Hi @Maxim-CADman77.  I may not have the answers to your questions, but I saw something in your two codes that seemed like it might need to be fixed though, and had an idea about a way to get the expected results.  In both of your code examples, you are iterating through the DVR's, but you are not 'activating' each DVR before inspecting it.  So, the name portion of the feedback may be correct, but the DesignViewTypeEnum portion of the feedback will be wrong, because the current iteration DVR will not always be the 'active' one, and you are always getting the DesignViewTypeEnum variation of the 'active' one.  I believe that you may need to change the following:

repMgr.ActiveDesignViewRepresentation.DesignViewType

...to something like:

dvr.DesignViewType

...and / or, you may need to activate each DVR immediately within the loop, before gathering feedback information from it.  I also suspect (but am not sure) that if you activate the DVR before checking its type, it may then show its correct type.  When one DVR is active, but you are inspecting another DVR that is not active (and not editable), that other inactive DVR's type may simply always be transient.  Not sure, just a thought.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 9

Maxim-CADman77
Advisor
Advisor

Yes - that was my silly mistake that lead to 'unexpected'  😄 DVR-type.
In fact types are:

MaximCADman77_0-1699879979062.png

Thanks!

 

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 5 of 9

WCrihfield
Mentor
Mentor

Interesting.  I just created a new empty part from a custom template that only has the [Primary] DVR, then manually added 3 more DVR's to it.  Then I created a similar iLogic rule and tried it out for myself.  I get expected results no matter if I activate each one or not.  However, I do not see the extra [Primary] one like you are seeing (using 2024.0.1).  Maybe the difference has something to do with them pre-existing in the template?

Wait...I think I just figured it out.  I was about to post this response, then I tried something else that produced the same result (extra Primary DVR in list).  It was due to having changed some things in the part.  I created a new custom WorkPlane, offset from one of the origin planes, then immediately afterwards, I ran my rule again, and the extra Primary DVR showed up, and its type was transient.  I suspected that it is a transient copy of the one that was active when the change was made, that will later be saved over the existing one.  I was correct, because then before my next test, I activated a different DVR (the WorkPlane I created was not visible in that other one), and then ran the rule again, and the extra Primary DVR was gone again.  Here is the code I was using in my tests too, just for reference.

Dim RepMgr As RepresentationsManager = ThisDoc.Document.ComponentDefinition.RepresentationsManager
If RepMgr Is Nothing Then
	Logger.Debug("RepresentationsManager Not Found!")
	Return
End If
'Dim OrigDVR As DesignViewRepresentation = RepMgr.ActiveDesignViewRepresentation
Dim DVRs As DesignViewRepresentations = RepMgr.DesignViewRepresentations
For Each DVR As DesignViewRepresentation In DVRs
'	If RepMgr.ActiveDesignViewRepresentation IsNot DVR Then
'		Try : DVR.Activate : Catch : End Try
'	End If
	Logger.Info(DVR.Name & vbCrLf & DVR.DesignViewType.ToString & vbCrLf)
Next
'If RepMgr.ActiveDesignViewRepresentation IsNot OrigDVR Then OrigDVR.Activate

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 9

Maxim-CADman77
Advisor
Advisor

@WCrihfield 

First of all thank you for time, efforts and ideas.

I can confirm that 'Primary-Transient' DVR disappears upon activating any DVR except the [Primary] one.
On the other hand I can NOT confirm that 'Primary-Transient' DVR presence is somehow related to any document change.

In fact I can reproduce the 'doubled-Primary effect' without adding WorkPlane and even without adding iLogic rule (in this test I use the code as external iLogic-rule).

I just create the IPT and the 'Primary-Transient' DVR is here, and it stays there after I save that new IPT. ... I just can't reproduce the situation when Primary DVR is one and active.

I'm a bit surprised to hear that you don't have same set of extra four (standard 'public') DVRs in your IPT template. I've checked several built-in templates and each contains 'Isometric', 'Front', 'Top' and 'Right' DVRs. You've purged yours, right?

Could you, please, post here (or to my PM) the IPT template (of any Inventor release) where API sees only one DVR?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 7 of 9

WCrihfield
Mentor
Mentor

Sure.  It may just be a design Standard related thing though.  For instance, when you open a part, go to the Tools tab, then click on Document Settings, then activate the Standard tab, there is a drop down list labeled Active Standard.  I believe that when installing Inventor, you come to a point where it wants you to select one of the available Standards from a list I believe is a lot longer than the example list shown below.  I get the same result whether I start a new part by clicking the New tool in the quick access toolbar, and choosing my custom empty one, or if I start a new part by using the File menu > New > Part process (generic template installed with Inventor, not a custom one).  But I believe we chose something like the regular ASME (inches) version on installation.  Not really sure if that is what causes this difference or not, just an assumption.  I have seen those DVR's in other folks parts that I have downloaded from the forum before though.

 

WCrihfield_0-1699888886579.png WCrihfield_1-1699889316894.png

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 9

Maxim-CADman77
Advisor
Advisor

@WCrihfield 
The API call discussed shows me TWO Primary DVRs in your IPT:

MaximCADman77_0-1699890606653.png

 

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 9 of 9

WCrihfield
Mentor
Mentor

Update:  When I use that rule as an external rule, start a empty part from my template, then run the rule, it does show that there is the regular [Primary] kMasterDesignViewType and also [Primary] kTransientDesignViewType also.  I don't know why though.  Maybe when the [Primary] one is active, a transient one needs to exist (or be created as preparation) to allow any potential visibility / appearance related changes, since the active one is 'locked'.  Just speculation though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes