Ilogic exporting true false parameters

Ilogic exporting true false parameters

SpokenEarth
Advocate Advocate
1,018 Views
6 Replies
Message 1 of 7

Ilogic exporting true false parameters

SpokenEarth
Advocate
Advocate

I have an ipt consisting true-false statements, how can i export these statement into iam
Thank you

0 Likes
Accepted solutions (3)
1,019 Views
6 Replies
Replies (6)
Message 2 of 7

FINET_Laurent
Advisor
Advisor

Hi,

 

I don't think you can ?

How I did is retrieve the parameter value using iLogic.

In the assembly you can create a rule and do :

 

If Parameter("Part.ipt", "Parameter") = True Then
	'do something here
Else If Parameter("Part.ipt", "Parameter") = False Then
	'do something here
End If

 Hope this helps.

Regards,


FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 3 of 7

WCrihfield
Mentor
Mentor
Accepted solution

You can try putting this iLogic rule in your main assembly which contains that part, then run it.  This will attempt to copy all Boolean type user parameters from that specifically named part to the active assembly.  It starts by getting the UserParameters object of the 'active' assembly.  Then, in order to get the UserParameters object of the target part, it starts looping through all referenced documents for the one by that name.  Once found, it gets its UserParameters object, so we can start working with both sets.  If it doesn't find that part, it lets you know, then exits the rule.  When both parameter groups are retrieved, it starts looping through the part's user parameters, checking their units type.  If 'Boolean', it then tries to set the value of the same parameter within the assembly, and if that fails, it tries to create a new user parameter within the assembly with the same name and value.  If both of those methods fail, it lets you know, then continues to any others or finishes.

Here's the code:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
	MsgBox("An Assembly Document must be active for this rule to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAUParams As UserParameters = oADoc.ComponentDefinition.Parameters.UserParameters
Dim oPUParams As UserParameters
Dim oFound As Boolean = False
For Each oRefDoc As Document In oADoc.AllReferencedDocuments
	If System.IO.Path.GetFileName(oRefDoc.FullFileName) = "TORISPHERICAL HEAD.ipt" Then
		Dim oPDoc As PartDocument = oRefDoc
		oPUParams = oPDoc.ComponentDefinition.Parameters.UserParameters
		oFound = True
		Exit For
	End If
Next
If oFound = False Then
	MsgBox("Couldn't find part named 'TORISPHERICAL HEAD.ipt' in the active assembly. Exiting.", vbOKOnly + vbExclamation, "")
	Exit Sub
End If

For Each oUParam As UserParameter In oPUParams
	If oUParam.Units = "Boolean" Then
		Try
			oAUParams.Item(oUParam.Name).Value = oUParam.Value
		Catch
			oAUParams.AddByValue(oUParam.Name, oUParam.Value, UnitsTypeEnum.kBooleanUnits)
		Catch
			MsgBox("Couldn't copy parameter named " & oUParam.Name & " from part to assembly.", , "")
		End Try
	End If
Next

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 7

SpokenEarth
Advocate
Advocate

It works!!! 🙂

Thank you so much

0 Likes
Message 5 of 7

SpokenEarth
Advocate
Advocate
Accepted solution

It seems like I can now import true-false statements into iam but i'm not allow to edit them......im I doing something wrong here?

0 Likes
Message 6 of 7

WCrihfield
Mentor
Mentor
Accepted solution

In which way can't you edit them?  Can you explain further?

 

Are you trying to change the value of the parameter within the main assembly document, then expecting it to also change the value of the same parameter within the part that it was copied from?  If so, you will need to 'link' the two parameters, not just copy them.  When they have just been copied from one document to another, the parameters are independent of each other.  If you do need to link the parameters, you would add them to the assembly in a slightly different way.  Here are is one link (of many) to a post where linking parameters between documents is discussed.

To add parameters in to current document from another

Basically, you access the parameters of both documents within the code.  Make sure the parameters that are to be linked are set as exposed/export within the parameters dialog of the source document.  Add the source parameters to an ObjectCollection, then add a derived parameter table to the target document, with that collection as the parameters to include in it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 7 of 7

SpokenEarth
Advocate
Advocate

My mistake....it works like a charm!!
Thank you so much again

0 Likes