Create Ilogic Help

Create Ilogic Help

cyndel.pigeon
Contributor Contributor
351 Views
1 Reply
Message 1 of 2

Create Ilogic Help

cyndel.pigeon
Contributor
Contributor

Hey!

How can I say :

 

Example:

(In an assembly)

 

If ''ComponentName'' is in the assembly Then

iProperties.Value("ComponentName", "Custom", "Vqty") = InputBox("ENTER QUANTITY FOR CABLE CLIPS GALVANIZED", "Vqty", "")

OR 

If ''CABLE CLIPS GALVANIZED:1'' is not in the assembly Then do nothing and proceed with the next line...

 

So I would like to say...if ''the component'' is in the assembly then modify one custom proprety by an input box...and if the component is not in the assembly then execute the next line in the rule...instead of doing nothing...I got an error message saying that the component cannot be found...

 

(Sorry if it's not clear...I'm not familiar with Ilogic)

 

SyntaxEditor Code Snippet

If Component.IsActive("CABLE CLIPS ALUMINIUM:1") = True Then
iProperties.Value("CABLE CLIPS ALUMINIUM:1", "Custom", "Vqty") = InputBox("ENTER QUANTITY FOR CABLE CLIPS GALVANIZED", "Vqty", "")
If Component.IsActive("CABLE CLIPS ALUMINIUM:1") = False Then
End If
End If

If Component.IsActive("CABLE CLIPS GALVANIZED:1") = True Then
iProperties.Value("CABLE CLIPS GALVANIZED", "Custom", "Vqty") = InputBox("ENTER QUANTITY FOR CABLE CLIPS", "Vqty", "")
End If

'ETC ...

 

Thanks!

 

 

0 Likes
Accepted solutions (1)
352 Views
1 Reply
Reply (1)
Message 2 of 2

philip1009
Advisor
Advisor
Accepted solution

That code is asking if a component with that name in the assembly is Active or not, which is meant to control suppression, not check if it exists.

Here's a sample to check if something exists in an Assembly:

 

SyntaxEditor Code Snippet

For Each oOcc As ComponentOccurrence In ThisDoc.Document.ComponentDefinition.Occurrences
	If oOcc.Name = "ComponentName" Then
		iProperties.Value(oOcc.Name, "Custom", "Vqty") = InputBox("ENTER QUANTITY FOR CABLE CLIPS GALVANIZED", "Vqty", )
	End If
Next

This is a For Each loop that checks through the collection of Occurrences (Parts and Assemblies) in the assembly document this rule is run from.  For Each Occurrence in the collection of Occurrences it will run what ever code between the For Each line and the line stating Next.

0 Likes