Ilogic replace components

Ilogic replace components

Anonymous
Not applicable
455 Views
0 Replies
Message 1 of 1

Ilogic replace components

Anonymous
Not applicable

Hi,

 

I want to replace a part in my assembly. That works fine with the component.replace function when I just write the code in an empty form.

 

But I have another form which opens an assembly and replaces a component. Then it does a save as function and it closes.

On this code the component.replace function doesn't work. Does anybody knows why it isn't working?

 

sorry for the bad english

SyntaxEditor Code Snippet

AssemDoc = ThisApplication.Documents.Open(Partlocatie)

oDoc = ThisApplication.activedocument
'Hier wordt het level of detail aangepast zodat alleen de gewenste configuratie zichtbaar wordt.
oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("LevelofDetail1").Activate
Parameter.Quiet = True
'Een aantal regels die variabelen definieren om daarna parameters uit te kunnen lezen.
Dim oOpenAssemDoc As Inventor.AssemblyDocument
oOpenAssemDoc = ThisApplication.ActiveDocument
oParams = oOpenAssemDoc.ComponentDefinition.Parameters
oUserParams = oParams.UserParameters
'Hier worden alle mogelijke parameters aangepast, de waardes die achter de variabele staan zijn er om een variatie te verbergen.                  
oUserParams.Item("Lengte").Value = Lengte/10
oUserParams.Item("Breedte").Value = Breedte/10
oUserParams.Item("Hoogte").Value = Hoogte/10
oUserParams.Item("Aandrijving").Value = Aandrijving
oUserParams.Item("Motorzijde").Value = Motorzijde
oUserParams.Item("Poot_Positie").Value = Pootpositie

Bandlocatie = "J:\Engineering\Stage\Koen Clemens\Test Factory design suite\Parametriche modellen\10160 B2 Frame" + Teller & ".ipt"
MessageBox.Show(Bandlocatie, "Ilogic")

'Het document wordt geupdated, opgeslagen en gesloten
Component.Replace("10160 B2 Frame", Bandlocatie, False)
Parameter.UpdateAfterChange = True
iLogicVb.UpdateWhenDone = True
oDoc.SaveAs(StrFolder + "\" + partnaam + "(" + Teller + ")" & (".iam"), True)
oDoc.Close(True)
0 Likes
456 Views
0 Replies
Replies (0)