Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Rule for Sweep Length

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
e_frissell
536 Views, 12 Replies

iLogic Rule for Sweep Length

e_frissell
Advocate
Advocate

 

 

Found a pretty slick rule for returning the length of a sweep which I'm using to me collect lengths for hoses and tubes however I'm having trouble with handling an error in a try-catch block and was wondering what the right way to handle the error where a sweep is not named Hose Sweep or Tube Sweep as right now it errors out if either of those names aren't found.  Secondly the parameter Sweeplength that it creates, I can't get it to round to 2 decimal places?

'Set a reference to the active part document
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

Dim opath As Path
Try :
	opath = oDef.Features.SweepFeatures.Item("Hose Sweep").Path
Catch :
	opath = oDef.Features.SweepFeatures.Item("Tube Sweep").Path
Catch :
	MsgBox("To get the length of your hose or tube the sweep feature needs to be named explicitly as Hose Sweep or Tube Sweep")
	Exit Sub
End Try



Dim TotalLength As Double
Dim roundLength As Double
TotalLength = 0

Dim oCurve As Object
Dim i As Integer

For i = 1 To opath.Count
oCurve = opath.Item(i).Curve

Dim oCurveEval As CurveEvaluator
oCurveEval = oCurve.Evaluator

Dim MinParam As Double
Dim MaxParam As Double
Dim length As Double

Call oCurveEval.GetParamExtents(MinParam, MaxParam)
Call oCurveEval.GetLengthAtParam(MinParam, MaxParam, length)

TotalLength = TotalLength + length
Next i

roundLength = Round(TotalLength, 2)

Dim oparams As Parameters
Dim oparam As Parameter
oparams = oDoc.ComponentDefinition.Parameters
Dim exists As Boolean
exists = False

'Find out if parameter exists
For Each oparam In oparams
If oparam.Name = "Sweeplength" Then exists = True
Next oparam

'Change the value if the parameter exists otherwise add the parameter

'MsgBox(roundLength & "   " & TotalLength)

If exists Then
oparams.Item("Sweeplength").Value = roundLength
Else
oparams.UserParameters.AddByValue("Sweeplength", roundLength, 11266)
End If
oDoc.Update

 

 

 

 

0 Likes

iLogic Rule for Sweep Length

 

 

Found a pretty slick rule for returning the length of a sweep which I'm using to me collect lengths for hoses and tubes however I'm having trouble with handling an error in a try-catch block and was wondering what the right way to handle the error where a sweep is not named Hose Sweep or Tube Sweep as right now it errors out if either of those names aren't found.  Secondly the parameter Sweeplength that it creates, I can't get it to round to 2 decimal places?

'Set a reference to the active part document
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

Dim opath As Path
Try :
	opath = oDef.Features.SweepFeatures.Item("Hose Sweep").Path
Catch :
	opath = oDef.Features.SweepFeatures.Item("Tube Sweep").Path
Catch :
	MsgBox("To get the length of your hose or tube the sweep feature needs to be named explicitly as Hose Sweep or Tube Sweep")
	Exit Sub
End Try



Dim TotalLength As Double
Dim roundLength As Double
TotalLength = 0

Dim oCurve As Object
Dim i As Integer

For i = 1 To opath.Count
oCurve = opath.Item(i).Curve

Dim oCurveEval As CurveEvaluator
oCurveEval = oCurve.Evaluator

Dim MinParam As Double
Dim MaxParam As Double
Dim length As Double

Call oCurveEval.GetParamExtents(MinParam, MaxParam)
Call oCurveEval.GetLengthAtParam(MinParam, MaxParam, length)

TotalLength = TotalLength + length
Next i

roundLength = Round(TotalLength, 2)

Dim oparams As Parameters
Dim oparam As Parameter
oparams = oDoc.ComponentDefinition.Parameters
Dim exists As Boolean
exists = False

'Find out if parameter exists
For Each oparam In oparams
If oparam.Name = "Sweeplength" Then exists = True
Next oparam

'Change the value if the parameter exists otherwise add the parameter

'MsgBox(roundLength & "   " & TotalLength)

If exists Then
oparams.Item("Sweeplength").Value = roundLength
Else
oparams.UserParameters.AddByValue("Sweeplength", roundLength, 11266)
End If
oDoc.Update

 

 

 

 

12 REPLIES 12
Message 2 of 13

Andrii_Humeniuk
Advisor
Advisor

Hi @e_frissell . For reliability, I suggest placing the Try-Catch statement in the middle of the Try-Catch. Regarding 2x values ​​after the comma. You use the AddByValue method to create the parameter, which means your value will automatically be multiplied by 10, so you need to round up to 3 decimal places.

'Set a reference to the active part document
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

Dim opath As Path
Try 
	Try : opath = oDef.Features.SweepFeatures.Item("Hose Sweep").Path
	Catch :	opath = oDef.Features.SweepFeatures.Item("Tube Sweep").Path
	End Try
Catch
	MsgBox("To get the length of your hose or tube the sweep feature needs to be named explicitly as Hose Sweep or Tube Sweep")
	Exit Sub
End Try

Dim TotalLength, roundLength As Double
TotalLength = 0

Dim oCurve As Object

For i As Integer = 1 To opath.Count
	oCurve = opath.Item(i).Curve
	
	Dim oCurveEval As CurveEvaluator = oCurve.Evaluator
	
	Dim MinParam, MaxParam, length As Double
	
	Call oCurveEval.GetParamExtents(MinParam, MaxParam)
	Call oCurveEval.GetLengthAtParam(MinParam, MaxParam, length)
	
	TotalLength = TotalLength + length
Next i

Dim oparams As Parameters = oDoc.ComponentDefinition.Parameters
Try
	oparams("Sweeplength").Value = Round(TotalLength, 3)
Catch
	oparams.UserParameters.AddByValue("Sweeplength", Round(TotalLength, 3), 11266)
End Try
oDoc.Update

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Hi @e_frissell . For reliability, I suggest placing the Try-Catch statement in the middle of the Try-Catch. Regarding 2x values ​​after the comma. You use the AddByValue method to create the parameter, which means your value will automatically be multiplied by 10, so you need to round up to 3 decimal places.

'Set a reference to the active part document
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

Dim opath As Path
Try 
	Try : opath = oDef.Features.SweepFeatures.Item("Hose Sweep").Path
	Catch :	opath = oDef.Features.SweepFeatures.Item("Tube Sweep").Path
	End Try
Catch
	MsgBox("To get the length of your hose or tube the sweep feature needs to be named explicitly as Hose Sweep or Tube Sweep")
	Exit Sub
End Try

Dim TotalLength, roundLength As Double
TotalLength = 0

Dim oCurve As Object

For i As Integer = 1 To opath.Count
	oCurve = opath.Item(i).Curve
	
	Dim oCurveEval As CurveEvaluator = oCurve.Evaluator
	
	Dim MinParam, MaxParam, length As Double
	
	Call oCurveEval.GetParamExtents(MinParam, MaxParam)
	Call oCurveEval.GetLengthAtParam(MinParam, MaxParam, length)
	
	TotalLength = TotalLength + length
Next i

Dim oparams As Parameters = oDoc.ComponentDefinition.Parameters
Try
	oparams("Sweeplength").Value = Round(TotalLength, 3)
Catch
	oparams.UserParameters.AddByValue("Sweeplength", Round(TotalLength, 3), 11266)
End Try
oDoc.Update

 

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 3 of 13
WCrihfield
in reply to: e_frissell

WCrihfield
Mentor
Mentor

Hi @e_frissell.  You could just loop through all SweepFeatures, instead of looking for one by a specific name.  If there will always be some portion of one of those names in the feature's name, then while looping through them, we could check if their name 'contains' specific pieces of text.

 

As for the parameter...we do not have control over how many decimal places a parameter shows within the Parameters dialog box.  It is a bit unpredictable.  We can certainly attempt to round values, but that may not eliminate trailing zeros.  You would have to represent the value as a String, then apply a format to the String to get the results you want.  Similar to how we can set parameters to export, then set the export properties & formatting.

 

Below is a very similar example iLogic rule for pretty much the same task, but it does not have the UserParameter creation part in it, because it may encounter multiple results, instead of just one.  While looping through multiple possible SweepFeatures, it collects the data into a Dictionary(Of String, Double), where the String is the name of the SweepFeature, and the Double is the rounded total length of its path curves.  It also writes each result to the iLogic Logger window.

Sub Main
	Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, Inventor.PartDocument)
	If oPDoc Is Nothing Then Return
	Dim oSweepFeats As SweepFeatures = oPDoc.ComponentDefinition.Features.SweepFeatures
	If oSweepFeats.Count = 0 Then Return
	Dim oResults As New Dictionary(Of String, Double)
	For Each oSweepFeat As SweepFeature In oSweepFeats
		Dim dTotalLength, dRoundLength As Double
		Dim oPath As Inventor.Path = oSweepFeat.Definition.Path
		For Each oPathEntity As PathEntity In oPath
			Dim oCurve As Object = oPathEntity.Curve
			Dim oCEval As CurveEvaluator = Nothing
			Try : oCEval = oCurve.Evaluator : Catch : End Try
			If oCEval Is Nothing Then Continue For
			Dim dMinParam, dMaxParam, dLength As Double
			oCEval.GetParamExtents(dMinParam, dMaxParam)
			oCEval.GetLengthAtParam(dMinParam, dMaxParam, dLength)
			dTotalLength = dTotalLength + dLength
		Next oPathEntity
		dRoundLength = Round(dTotalLength, 2)
		oResults.Add(oSweepFeat.Name, dRoundLength)
		Logger.Info(vbCrLf & oSweepFeat.Name & " sweep length = " & dRoundLength.ToString)
	Next oSweepFeat
	'now use the data within the oResults collection as you would like
End Sub

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

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Hi @e_frissell.  You could just loop through all SweepFeatures, instead of looking for one by a specific name.  If there will always be some portion of one of those names in the feature's name, then while looping through them, we could check if their name 'contains' specific pieces of text.

 

As for the parameter...we do not have control over how many decimal places a parameter shows within the Parameters dialog box.  It is a bit unpredictable.  We can certainly attempt to round values, but that may not eliminate trailing zeros.  You would have to represent the value as a String, then apply a format to the String to get the results you want.  Similar to how we can set parameters to export, then set the export properties & formatting.

 

Below is a very similar example iLogic rule for pretty much the same task, but it does not have the UserParameter creation part in it, because it may encounter multiple results, instead of just one.  While looping through multiple possible SweepFeatures, it collects the data into a Dictionary(Of String, Double), where the String is the name of the SweepFeature, and the Double is the rounded total length of its path curves.  It also writes each result to the iLogic Logger window.

Sub Main
	Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, Inventor.PartDocument)
	If oPDoc Is Nothing Then Return
	Dim oSweepFeats As SweepFeatures = oPDoc.ComponentDefinition.Features.SweepFeatures
	If oSweepFeats.Count = 0 Then Return
	Dim oResults As New Dictionary(Of String, Double)
	For Each oSweepFeat As SweepFeature In oSweepFeats
		Dim dTotalLength, dRoundLength As Double
		Dim oPath As Inventor.Path = oSweepFeat.Definition.Path
		For Each oPathEntity As PathEntity In oPath
			Dim oCurve As Object = oPathEntity.Curve
			Dim oCEval As CurveEvaluator = Nothing
			Try : oCEval = oCurve.Evaluator : Catch : End Try
			If oCEval Is Nothing Then Continue For
			Dim dMinParam, dMaxParam, dLength As Double
			oCEval.GetParamExtents(dMinParam, dMaxParam)
			oCEval.GetLengthAtParam(dMinParam, dMaxParam, dLength)
			dTotalLength = dTotalLength + dLength
		Next oPathEntity
		dRoundLength = Round(dTotalLength, 2)
		oResults.Add(oSweepFeat.Name, dRoundLength)
		Logger.Info(vbCrLf & oSweepFeat.Name & " sweep length = " & dRoundLength.ToString)
	Next oSweepFeat
	'now use the data within the oResults collection as you would like
End Sub

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

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 13
Frederick_Law
in reply to: e_frissell

Frederick_Law
Mentor
Mentor

Also internal value could be in cm.

Also internal value could be in cm.

Message 5 of 13

Curtis_Waguespack
Consultant
Consultant

@e_frissell 

 

Here's another approach

 

'Set a reference to the active part document
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

Dim oList As New List(Of String)
oList.Add("") 'zero in the list
oList.Add("Hose Sweep") 'one in the list
oList.Add("Tube Sweep") 'two in the list


For i = 1 To 2
	Try :
		oSweep = oDef.SweepFeatures.Item(oList.Item(i))
		Exit For
	Catch
		If i = 2 And oSweep Is Nothing Then
			MsgBox("Sweep not found")
			Exit Sub
		End If
	End Try
Next

MsgBox(oSweep.name)

@e_frissell 

 

Here's another approach

 

'Set a reference to the active part document
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

Dim oList As New List(Of String)
oList.Add("") 'zero in the list
oList.Add("Hose Sweep") 'one in the list
oList.Add("Tube Sweep") 'two in the list


For i = 1 To 2
	Try :
		oSweep = oDef.SweepFeatures.Item(oList.Item(i))
		Exit For
	Catch
		If i = 2 And oSweep Is Nothing Then
			MsgBox("Sweep not found")
			Exit Sub
		End If
	End Try
Next

MsgBox(oSweep.name)
Message 6 of 13
Michael.Navara
in reply to: e_frissell
Message 7 of 13
e_frissell
in reply to: WCrihfield

e_frissell
Advocate
Advocate

Thanks!  Iterating through all the sweeps looking for specific names was one of the approaches I thought would work really well too.  My ultimate goal was to get hose length into the Inventor BOM so the required length of hose required for the assembly could be passed on to the ERP system.  I liked writing the value as a double (shoot, even rounding up an integer value would work come to think of it) HOWEVER I found out that if the length of hose changes and the parameters are updated, the length in the BOM doesn't change which is really frustrating. 

 

I'd assume that if you write a text value to the properties it wouldn't be possible to add them together unless you convert from string back to int or double, but then doing that would mean that a separate iLogic rule would likely be necessary for BOM population and ensuring that value is always up to date?

0 Likes

Thanks!  Iterating through all the sweeps looking for specific names was one of the approaches I thought would work really well too.  My ultimate goal was to get hose length into the Inventor BOM so the required length of hose required for the assembly could be passed on to the ERP system.  I liked writing the value as a double (shoot, even rounding up an integer value would work come to think of it) HOWEVER I found out that if the length of hose changes and the parameters are updated, the length in the BOM doesn't change which is really frustrating. 

 

I'd assume that if you write a text value to the properties it wouldn't be possible to add them together unless you convert from string back to int or double, but then doing that would mean that a separate iLogic rule would likely be necessary for BOM population and ensuring that value is always up to date?

Message 8 of 13
WCrihfield
in reply to: e_frissell

WCrihfield
Mentor
Mentor
Accepted solution

Yep.  These code examples are just gathering data from existing geometry.  But in order to keep the value updated after any changes, you would need to include some events monitoring.  Essentially, when the size/shape of the model changes, then run this code again automatically, to make sure the value(s) are updated.  In parts only, we have an event named "Part Geometry Change" in the Event Triggers dialog, which would be a good fit for this type of situation.  If you put an iLogic rule like one of the above examples (or your own customized variation), under that event in the Event Triggers dialog, that should help ensure that the value(s) stay up to date.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Yep.  These code examples are just gathering data from existing geometry.  But in order to keep the value updated after any changes, you would need to include some events monitoring.  Essentially, when the size/shape of the model changes, then run this code again automatically, to make sure the value(s) are updated.  In parts only, we have an event named "Part Geometry Change" in the Event Triggers dialog, which would be a good fit for this type of situation.  If you put an iLogic rule like one of the above examples (or your own customized variation), under that event in the Event Triggers dialog, that should help ensure that the value(s) stay up to date.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 9 of 13
e_frissell
in reply to: e_frissell

e_frissell
Advocate
Advocate

Ah, an event trigger, of course!  That is a great idea and I can add this to the assembly/drawing as well to ensure the length is calculated accurately as well.  Thanks for that!

0 Likes

Ah, an event trigger, of course!  That is a great idea and I can add this to the assembly/drawing as well to ensure the length is calculated accurately as well.  Thanks for that!

Message 10 of 13
WCrihfield
in reply to: e_frissell

WCrihfield
Mentor
Mentor

Just pointing out another tool that could be used in a situation like this.

MeasureTools.GetLoopLength 

I tried finding the online help documentation about the method (GetTruePath) shown in the API sample that was linked to in Michael's response above, which should have been directly under the SweepFeatures collection object, but I could not find it.  It may still be there, but it may have got hidden.  Anyways, it seems to suggest that if the centroid of the profile is not where the path starts, then the length of the profile segments alone may not be accurate to the length of the resulting swept model geometry.  Not sure if the 'GetLoopLength' method linked to here accounts for that or not.  You can review its online documentation for the 6 different possible things you can provide as input into it, making it pretty dynamic.  Just remember that this is Inventor API method, so results will likely be in database units, instead of document units.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Just pointing out another tool that could be used in a situation like this.

MeasureTools.GetLoopLength 

I tried finding the online help documentation about the method (GetTruePath) shown in the API sample that was linked to in Michael's response above, which should have been directly under the SweepFeatures collection object, but I could not find it.  It may still be there, but it may have got hidden.  Anyways, it seems to suggest that if the centroid of the profile is not where the path starts, then the length of the profile segments alone may not be accurate to the length of the resulting swept model geometry.  Not sure if the 'GetLoopLength' method linked to here accounts for that or not.  You can review its online documentation for the 6 different possible things you can provide as input into it, making it pretty dynamic.  Just remember that this is Inventor API method, so results will likely be in database units, instead of document units.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 11 of 13
e_frissell
in reply to: e_frissell

e_frissell
Advocate
Advocate

Thanks @WCrihfield, I'll try playing with some of these and see if something works.

 

Since you suggested using the event trigger to keep track of any changes it got me wondering whether or not there would be an automatic way to easily control the BOM since, after all, the intent here is to get the correct length of hose into the BOM and have it capture any changes.  The rule would need to be ran every time a somewhat basic function was performed (likely before save event trigger) and it would need a way of quickly determining if a parts geometry had changed and, if one had changed, recalculating the total length.  What are your thoughts on this: creating a custom property, say it's called OutOfDate, that has a value of 0 or 1 which is part of the rule that updates on part geometry change.  Would it be relatively quick for a rule to run before save that iterates through all the parts looking for OutOfDate to be 1 and, if so, re-calculate the total length of everything and reset the value to 0 in the part?

0 Likes

Thanks @WCrihfield, I'll try playing with some of these and see if something works.

 

Since you suggested using the event trigger to keep track of any changes it got me wondering whether or not there would be an automatic way to easily control the BOM since, after all, the intent here is to get the correct length of hose into the BOM and have it capture any changes.  The rule would need to be ran every time a somewhat basic function was performed (likely before save event trigger) and it would need a way of quickly determining if a parts geometry had changed and, if one had changed, recalculating the total length.  What are your thoughts on this: creating a custom property, say it's called OutOfDate, that has a value of 0 or 1 which is part of the rule that updates on part geometry change.  Would it be relatively quick for a rule to run before save that iterates through all the parts looking for OutOfDate to be 1 and, if so, re-calculate the total length of everything and reset the value to 0 in the part?

Message 12 of 13
WCrihfield
in reply to: e_frissell

WCrihfield
Mentor
Mentor

Hi @e_frissell.  I am not sure how you would keep that custom iProperty's value updated.  Sure the rule that gets the length of the sweep and records it could set it to one of the values, but then how does that iProperty's value get switched to the other value that would indicate that it is not up to date?

 

Maybe the most accurate way to do this (instead of using the Event Triggers dialog) would be to use the exact ModelParameters/UserParameters that control the size & shape of that sweep as 'triggers' in an internal (saved within the document) iLogic rule.  What I mean by using them as triggers is...have a series of 'dummy variables' (not used for anything, can all be the same variable) and set their values to those blue, unquoted parameter names.  Just the presence of those blue, unquoted parameter names within that internal rule will cause that rule to get ran every time any of their values changes.  Then, within that internal rule, after those dummy variables, could be your code to retrieve and record sweep lengths.  Or, instead of that retrieval/recording code directly, this internal rule could simply call your external rule (that does that task) to run.  I use the strategy of simplistic internal rules which only contain parameter triggers and a line of code to run an external rule quite often, because it usually more efficient than using the far more general Event Triggers.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Hi @e_frissell.  I am not sure how you would keep that custom iProperty's value updated.  Sure the rule that gets the length of the sweep and records it could set it to one of the values, but then how does that iProperty's value get switched to the other value that would indicate that it is not up to date?

 

Maybe the most accurate way to do this (instead of using the Event Triggers dialog) would be to use the exact ModelParameters/UserParameters that control the size & shape of that sweep as 'triggers' in an internal (saved within the document) iLogic rule.  What I mean by using them as triggers is...have a series of 'dummy variables' (not used for anything, can all be the same variable) and set their values to those blue, unquoted parameter names.  Just the presence of those blue, unquoted parameter names within that internal rule will cause that rule to get ran every time any of their values changes.  Then, within that internal rule, after those dummy variables, could be your code to retrieve and record sweep lengths.  Or, instead of that retrieval/recording code directly, this internal rule could simply call your external rule (that does that task) to run.  I use the strategy of simplistic internal rules which only contain parameter triggers and a line of code to run an external rule quite often, because it usually more efficient than using the far more general Event Triggers.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 13 of 13
_dscholtes_
in reply to: e_frissell

_dscholtes_
Advocate
Advocate

@e_frissell wrote:

... it would need a way of quickly determining if a parts geometry had changed and, if one had changed, recalculating the total length.

I'd always recalculate the length (easy way out), unless recalculating is a time-consuming process.

 

I'd also prefer to let the part handle its updating, as it is to be saved anyway, and not have an assembly or drawing handle it (you'll need additional checks and stuff).

0 Likes


@e_frissell wrote:

... it would need a way of quickly determining if a parts geometry had changed and, if one had changed, recalculating the total length.

I'd always recalculate the length (easy way out), unless recalculating is a time-consuming process.

 

I'd also prefer to let the part handle its updating, as it is to be saved anyway, and not have an assembly or drawing handle it (you'll need additional checks and stuff).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report