Use an option of the helicoid function with iLogic

Use an option of the helicoid function with iLogic

jgomis.ext
Enthusiast Enthusiast
361 Views
5 Replies
Message 1 of 6

Use an option of the helicoid function with iLogic

jgomis.ext
Enthusiast
Enthusiast

Hi,

I would like to select with iLogic the rotation way of my helicoid function to control it in a form.

jgomisext_0-1668438867526.png

Do you have any ideas of how to do it ?

Thanks 🙂

0 Likes
362 Views
5 Replies
Replies (5)
Message 2 of 6

dalton98
Collaborator
Collaborator

try this

Dim oList As New ArrayList
oList.Add("Left")
oList.Add("Right")
inputvalue = InputListBox("Select rotation", oList, "Left", Title := "Title", ListName := "List")

Dim oDoc As PartDocument = ThisDoc.Document
Dim oFeature As PartFeature
For Each oFeature In oDoc.ComponentDefinition.Features
	If oFeature.Type = kCoilFeatureObject
		Dim oCoil As CoilFeature = oFeature		
'		oCoil.ClockwiseRotation = Not oCoil.ClockwiseRotation
		If inputvalue = "Left"
			oCoil.ClockwiseRotation = True
		Else If inputvalue = "Right"
			oCoil.ClockwiseRotation = False
		End If
	End If
Next
Message 3 of 6

WCrihfield
Mentor
Mentor

Hi @jgomis.ext.  That dialog looks like the dialog for creating a coil feature in a part.  And the controls you have circled are basically just represented by a Read/Write Boolean type property in the CoilFeature object named ClockwiseRotation.  This property is False by default, which means that it would be counter-clockwise rotation, instead of clockwise rotation.  When I hover those two controls with my mouse, their tool tip says either Left Hand, or Right Hand, and right hand would mean clockwise rotation, because that is the direction that the hands on a clock rotate.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

jgomis.ext
Enthusiast
Enthusiast

I have 3 helicoids function in my part. Do I have the possibility to do it for only one of my function ?

0 Likes
Message 5 of 6

dalton98
Collaborator
Collaborator

@jgomis.ext 

You would need to get rid of the for loop and set the feature object to that specific one

oFeature = oDoc.ComponentDefinition.Features.Item("Helicoide2")
0 Likes
Message 6 of 6

WCrihfield
Mentor
Mentor

Just another possible way, which prompts the user for each one found in the current part, and shows the feature's name for each.  I haven't tested this yet, because I don't have a part with multiple coil features in it right now.

 

Dim oPDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oCFs As CoilFeatures = oPDef.Features.CoilFeatures
If oCFs.Count = 0 Then
	MsgBox("No CoilFeatures found. Exiting rule.", vbExclamation, "")
	Exit Sub
End If
For Each oCF As CoilFeature In oCFs
	bBool = InputRadioBox("CoilFeature named:  " & oCF.Name _
	& vbCrLf & "RIGHT = Clockwise / LEFT = CounterClockwise", "RIGHT", "LEFT", False, "RIGHT or LEFT")
	oCF.ClockwiseRotation = bBool
Next

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)