asking for help with iLogic.

asking for help with iLogic.

cjfgns1003
Advocate Advocate
265 Views
3 Replies
Message 1 of 4

asking for help with iLogic.

cjfgns1003
Advocate
Advocate

I would like to assign the result value of the "B" logic to the "L" value of the "A" logic below.
In other words, I want to combine "A" logic and "B" logic. What should I do?

 

"A" iLogic

iProperties.Value("custom", "SIZE") = "Ø" & Round(Parameter("D1"), 1) & "xt" & Round(Parameter("T0"), 1) & "x" & Round(Parameter("L"), 1) & "L"

 

"B" iLogic

Sub main
    Dim oDoc As PartDocument = ThisApplication.ActiveDocument
    Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
	Dim LengthTotal As Double = 0
	Dim oPath As Path
	For Each oSweep As SweepFeature In oDef.Features.SweepFeatures
		oPath = oSweep.Definition.Path
		LengthTotal = LengthTotal + GetLengthOfSweep(oPath)
	Next

    Dim oUParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
    Dim oExists As Boolean = False
	Dim oParamName As String = "SIZE"
    For Each oUParam As UserParameter In oUParams
    	If oUParam.Name = oParamName Then
			oUParam.Value = LengthTotal
			oExists = True
		End If
    Next

    If oExists = False Then
        oUParams.AddByValue(oParamName, LengthTotal, UnitsTypeEnum.kDefaultDisplayLengthUnits)
    End If
	ParaExport(oDef.Parameters.UserParameters, oParamName, koneDecimalPlacePrecision)
    oDoc.Update
End Sub

Private Function GetLengthOfSweep(ByVal oPath As Path) As Double
    Dim TotalLength As Double = 0
    Dim oCurve As Object
	Dim oCurveEval As CurveEvaluator
	Dim MinParam As Double
    Dim MaxParam As Double
    Dim length As Double
    For i As Integer = 1 To oPath.Count
        oCurve = oPath.Item(i).Curve 
        oCurveEval = oCurve.Evaluator
        oCurveEval.GetParamExtents(MinParam, MaxParam)
        oCurveEval.GetLengthAtParam(MinParam, MaxParam, length)
        TotalLength = TotalLength + length
    Next
	Return TotalLength
End Function

Private Sub ParaExport(ByRef oUParas As UserParameters, ByVal oParaName As String, _
						ByVal oDecimalPrecision As CustomPropertyPrecisionEnum)
    For Each oUPara As UserParameter In oUParas
		If oUPara.Name = oParaName Then
            oUPara.ExposedAsProperty = True
			Dim oCPF As CustomPropertyFormat = oUPara.CustomPropertyFormat
			oCPF.PropertyType = CustomPropertyTypeEnum.kNumberPropertyType
            oCPF.Precision = oDecimalPrecision
			oUPara.Comment = "스윕길이로 산출함."
            Exit Sub
        End If
    Next
End Sub

 

0 Likes
Accepted solutions (2)
266 Views
3 Replies
Replies (3)
Message 2 of 4

bradeneuropeArthur
Mentor
Mentor
declare 2 pubic variable A1 And B1 that are set in the Code of A either In the Code of B.
you now can merge the A1 and B1 like Msgbox( A1 & B1)

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @cjfgns1003.  Try just moving that one line of code in 'A' to just before the 'End Sub' line at the end of your Sub Main area (around line 25 or line 26) in 'B'.  Or maybe just before that oDoc.Update line, depending on your needs.

 

Edit:  Actually, that might not work either, because that custom iProperty named "SIZE" is controlled by the Parameter by the same name, because that Parameter is getting exported (exposed as a custom iProperty).  When that is the case, any time the value of that parameter changes, it will instantly change the value of that custom iProperty by the same name to the new value of that Parameter.  You may need to create & use a different custom iProperty with a slightly different name, if you want to customize its value like that.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 4

cjfgns1003
Advocate
Advocate
Accepted solution

The "L" value was not set, but what is the principle shown in the result?

0 Likes