Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
m.huester
287 Views, 6 Replies

neu angelgten Paramters per iLogic - MultiValueList füllen

Hallo Community,

 

ich habe ein Problem beim füllen eines zuvor neu angelgten Paramters per iLogic.

 

Der Paramter wird zwar erzeugt , aber nicht ausgefüllt.

Erscheint in den fx-Parametern also als leer.

zur Kontrolle habe ich den Wert in die iProperties schreiben lassen. Dies funktioniert auch.

 

Wir arbeiten mit Inventor 2024.2

 

Bin dankbar für jede Idee

 

Hier der Code:

 

'erstellt einen benutzerdefinierten Parameter SML , falls leer oder nicht vorhanden:
	If iProperties.Value("Summary", "Keywords") = "" Then
	'legt den Paramter an
		oPara = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
		oParameter = oPara.AddByValue("SML", "", kTextUnits) 
		Else If iProperties.Value("Summary", "Keywords") <> "" Then 'verhindert das überschreiben einer vorhanden SML
		'und beendet das Programm
	GoTo 100
	End If

'öfnnet eine Auswahlliste zum füllen des Parameters und des iProperties
MultiValue.SetList("SML", "Wert1","Wert2","Wert3")
SML = InputListBox("bitte doppelklick auf Auswahl", MultiValue.List("SML"), SML, Title := "SML nach Vornummer", ListName := "Liste")
	

iProperties.Value("Summary", "Keywords") = SML

	iLogicVb.UpdateWhenDone = True
    Parameter.UpdateAfterChange = True
    InventorVb.DocumentUpdate()

100 :
vpeuvion
in reply to: m.huester

Hi, Can you try this : 

oPara = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
Try
  Param = Parameter("SML")
Catch
  oPara.AddByValue("SML", "", kTextUnits)
  MultiValue.SetList("SML", "Wert1", "Wert2", "Wert3")
End Try

If iProperties.Value("Summary", "Keywords") = "" Then
SML = InputListBox("bitte doppelklick auf Auswahl", MultiValue.List("SML"), SML, Title := "SML nach Vornummer", ListName := "Liste")
iProperties.Value("Summary", "Keywords") = SML
iLogicVb.UpdateWhenDone = True
Parameter.UpdateAfterChange = True
InventorVb.DocumentUpdate()
End If

Vincent.

 

m.huester
in reply to: vpeuvion

Thanks for your answer, but the  reslut is the same.

there is no entry in the param:

 

mhuester_0-1702284490953.png

 

vpeuvion
in reply to: m.huester

Yes you are right, strangely, you have to select the value once manually for it to work afterwards.
Try this modified code, it works fine on my side:

oPara = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
Try
  Param = Parameter.Param("SML")
Catch
  oPara.AddByValue("SML", "", kTextUnits)
  MultiValue.SetList("SML", "Wert1", "Wert2", "Wert3")
  Parameter.Param("SML").Value = "Wert1"
End Try

If iProperties.Value("Summary", "Keywords") = "" Then
Parameter.Param("SML").Value = InputListBox("bitte doppelklick auf Auswahl", MultiValue.List("SML"), SML, Title := "SML nach Vornummer", ListName := "Liste")
iProperties.Value("Summary", "Keywords") = Parameter.Param("SML").Value
iLogicVb.UpdateWhenDone = True
Parameter.UpdateAfterChange = True
InventorVb.DocumentUpdate()
End If

Vincent.

 

m.huester
in reply to: vpeuvion

Hi,

thanks a lot, but its the same mistake.

The param SML does not update.

I have tried to change the order:
first the param and then the set list but that doesn't help either.

 

Did you work with 2024? I now think that this is a programme error ?

 

Catch
  oPara.AddByValue("SML", "", kTextUnits)
  Parameter.Param("SML").Value = "Wert1"
MultiValue.SetList("SML", "Wert1", "Wert2", "Wert3")
End Try

 

vpeuvion
in reply to: m.huester

Hi,

I'm using the latest version of Inventor 2023.
It works on my side, I can no longer reproduce the error.
Can you try this modification:

Catch
  oPara.AddByValue("SML", "Wert1", kTextUnits)
  MultiValue.SetList("SML", "Wert1", "Wert2", "Wert3")
End Try

I broke the code into two parts:
- Create the parameter if it does not exist:

oPara = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
Try
  Param = Parameter.Param("SML")
Catch
  oPara.AddByValue("SML", "Wert1", kTextUnits)
  MultiValue.SetList("SML", "Wert1", "Wert2", "Wert3")
End Try

 - Modify the value of the existing parameter:

Parameter.Param("SML").Value = InputListBox("bitte doppelklick auf Auswahl", MultiValue.List("SML"), SML, Title := "SML nach Vornummer", ListName := "Liste")
iLogicVb.UpdateWhenDone = True
Parameter.UpdateAfterChange = True
InventorVb.DocumentUpdate()

If you test each part separately, what results do you get?

Vincent.

 

m.huester
in reply to: vpeuvion

Hi Vincent,

 

this one works :slightly_smiling_face:

 

Parameter.Param("SML").Value

Such a small thing with such a big effect.

Thanks a lot and have a nice day