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: 

Cange of DesignViewRepresentation via iLogic

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
markus_leukers_edschaTS
732 Views, 6 Replies

Cange of DesignViewRepresentation via iLogic

Hello Community,

 

I've read through a few forums and thread but i havent got my answer yet.

 

i'm trying to create a complex assembly group which i want to configure via iLogic. It works fine but now i'm on the point where i want to change the DesignViewRepresentation of some Assemlby Groups in my Assembly Group.

 

My Assembly Group is called "900001_iLogic.iam" and the part which i want to change is "400431.iam". 400431 has three designviewrepresentations, "Master", "Open" and "Close".

 

How can i easily say via iLogic something like that:

 

If view="Open" Then

change DesignViewRepresentation of 400431 to "Open"

ElseIf view="Closed" Then

change DesignViewRepresentation of 400431 to "Closed"

End If

 

Is this possible?

 

Best regards and thanks in advance

 

Markus

6 REPLIES 6
Message 2 of 7

Hi markus.leukers,

 

I'm not sure I understand some of the terms. When you say Assembly Group do you mean sub-assembly?

 

So the goal then is to change the View Representation at the top level assembly, and then have it change the View Representation in a named subassembly?

 

Can you confirm that, or correct me if I've not understood properly?

 

Also, just as a note for next time, this is likely better suited for the Inventor Customization forum :
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 3 of 7

First to clarify something -- What do you mean by Assembly Group? Do you just mean Assembly? If so, assemblies are by definition a "group" of components, so there's no need to tack on an additional term -- it just causes confusion 🙂

 

Now, when you say "If view=Open"/"If view=Closed", I'm assuming by "view" you mean the View Rep of your top assembly, i.e. 900001_iLogic.iam? In other words, you are trying to drive the View Rep of your subassembly (400431.iam) based on the view rep of the parent assembly (900001_iLogic.iam)?

 

If so, the following code will do that:

 

Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oDef As ComponentDefinition = oDoc.ComponentDefinition
Dim oCompOcc As Inventor.ComponentOccurrence

oCurrentView = oDef.RepresentationsManager.ActiveDesignViewRepresentation.Name

For Each oCompOcc in oDef.Occurrences
	oName = oCompOcc.Name
	oName = Left(oName,InStr(oName,":")-1)
	If oName = "400431" Then
		If Not oCompOcc.ActiveDesignViewRepresentation = oCurrentView Then 
			Try
				oCompOcc.SetDesignViewRepresentation(oCurrentView,, True)
			Catch
				FoundError = True
				Continue For
			End Try
		End If
	End If
Next

If FoundError = True Then 
	MessageBox.Show("One or more occurrences could not be set to the appropriate View Representation")
End If

 

Unfortunately, there's no way to set the rule to trigger when you change View Reps. What you could do, is modify the code to iterate through each of your parent assembly's View Reps and run the above code, which would essentially apply the appropriate sub-view-rep for each master View Rep. You could then set that up to run each time you save your assembly. I can add in that functionality if you want, or you can just manually run the above code for each of your master View Reps, and remember to do so any time you add a new occurrence of your subassembly.

 

Message 4 of 7
Cris-Ideas
in reply to: DRoam

@DRoam

Hi,

I am not familiar with iLogic, but I (as many others) have well known problem with DVR and reading your post I thought it can be workaround with iLogic (perhaps). So I decided to join this thread with a following question?

 

Would it be a big problem to write a rule that would set DVR of all components that have visibility status set to true to "Default" + Associative for a given DVR of top level assembly?

 

Problem is of course that after turning component on and off it is retried to "Master" instead of "Default" or previously set DVR, witch in turn makes it totally unusable because all work features are on in master DVR.

 

Cris.

Cris,
https://simply.engineering
Message 5 of 7

Message 6 of 7

Hello,

 

first of all, thank you all for your quick reply, but i think you've not understand what i'd like to do. I will explain it a little bit more (and sorry for the term "assembly-group" instead of assembly. In germany it is "Bau-Gruppe")

 

900001_iLogic.iam is the "Main-Assembly", thats correct.

 

400431.iam is a subassembly, thats correct too.

 

I want to change the view rep of 400431, thats correct, but not in the case the design rep of "900001..." is changed.

 

I've created a user Parameter, called "view" and it is contains a multi-value list. In this list there are two options, "Open" and "Closed".

 

The user Parameter i've used in a iLogic form. What i want to do now is, if someone chooses in the iLogic-Form the state of view (open or closed) and presses the apply button in my form, there should be a rule which changes the view rep of 400431.iam.

 

I hope you've understood me now - the code of DRoam doest help me in that case i think.

 

BR Markus

 

Message 7 of 7

Hello,

 

i'd like to share my experience since i figured out, how to do it. My first idea, to solve this problem with the design view representations was not the best. Instead of that, i did it with the parameter-function.

 

Now i'm controlling the parameter in the "sub-part" with the parameter function:

 

Parameter("XXX:1", "Parametername") = ... mm

 

This works fine for me and now i can controll sub-assemblys with my main assembly via iLogic.

 

Thank you all 🙂

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

Post to forums  

Autodesk Design & Make Report