ilogic snippet replace LoD can View Representations also be used?

ilogic snippet replace LoD can View Representations also be used?

andrew_canfield
Collaborator Collaborator
408 Views
2 Replies
Message 1 of 3

ilogic snippet replace LoD can View Representations also be used?

andrew_canfield
Collaborator
Collaborator

Hello 

 

iLogic includes the snippet:

 

Component.Replace("SubAssembly:1", "OtherAssembly.iam<LevelOfDetail1>", True)

 is it also possible to replace a file with one at a specific View Representation? 

 

Regards

 

Andrew

0 Likes
Accepted solutions (1)
409 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

I don't believe there is another simple 1 line solution for what you are asking for.  That Component.Replace() is basically a shortcut Sub defined within the iLogic add-in.  There is most likely a definition for that Sub somewhere in the iLogic add-in that dictates how it works.  You would have to create your own reference Sub that would work the way you want, then use its single line call to run it.  That Sub can either be within the same Rule/Macro (after Sub Main...End Sub) or it can be in another Rule.  If referencing the Sub in another Rule (or text file), you will have to reference it in the header of the rule that is going to use it (AddVbRule for a local rule, or AddVBFile for an external rule), and it will have to be set-up correctly (with 'Straight VB Code option turned on, and with main Class or Module wrapper).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @andrew_canfield 

 

I don't think there is anything in the iLogic calls (I could be wrong).... but you could use something like this combining iLogic and API

 

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

 

Note too, in this example Test_Also.iam already exists in memory (for instance that file is already used in the active assembly)... but if that's not the case use the full path for that assembly.

 

 

Dim oCompOcc As Inventor.ComponentOccurrence
oCompOcc = Component.InventorComponent("Test:1")
Component.Replace(oCompOcc.Name, "Test_Also.iam", True)
oCompOcc.SetDesignViewRepresentation("MyViewRep",, True)

 

 

EESignature