i am just creating a code for Variable Helix
i am not able to see any objects to call in 3Dsketch For Project Surface
i can call Intersection Curves and Silhouette Curves
This What i am Trying to do
i have Created a code up to placing a Constuction Geometry
But there i am not able to
project curve surface(Wrap to Surface options) via API
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
Solved by ekinsb. Go to Solution.
So Far i Was able to do
SyntaxEditor Code Snippet
Sub Main() ' Defining This Document Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument 'Definining a Component Definition Dim oPartDef As PartComponentDefinition oPartDef = oPartDoc.ComponentDefinition ' Create a 2D sketch on the X-Y plane. Dim sketch1 As PlanarSketch sketch1 = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(3)) 'Collecting Transient Geometry Dim tg As TransientGeometry tg = ThisApplication.TransientGeometry ' Create's a Projected Centre Point Dim oProjectionPoint1 As SketchPoint oProjectionPoint1 = sketch1.AddByProjectingEntity(oPartDef.WorkPoints.Item(1)) ' Converting cm to mm Dim tempRadius As Double Dim oRadius As Double tempRadius = InputBox("Enter The Radius of Helix", "Capricot", "10") oRadius = tempRadius/10 ' Create a circle Dim oCircle1 As SketchCircle oCircle1 = sketch1.SketchCircles.AddByCenterRadius(tg.CreatePoint2d(0, 0),oRadius) Call oCircle1.CenterSketchPoint.Merge(oProjectionPoint1) 'Dimensioning a circle Dim oDimCircle As DiameterDimConstraint oDimCircle = sketch1.DimensionConstraints.AddDiameter(oCircle1, tg.CreatePoint2d(0, (oRadius*2))) Dim tempLength As Double Dim oLength As Double tempLength = InputBox("Enter The Length of Helix", "Capricot", "60") oLength = tempLength/10 ' Create a solid extrusion. Dim oProfile As Profile oProfile = sketch1.Profiles.AddForSolid Dim oExtrudeDef1 As ExtrudeDefinition oExtrudeDef1 = oPartDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kNewBodyOperation) Call oExtrudeDef1.SetDistanceExtent(oLength, kNegativeExtentDirection) Dim oExtrusion1 As ExtrudeFeature oExtrusion1 = oPartDef.Features.ExtrudeFeatures.Add(oExtrudeDef1) ' Get the cylindrical face of the solid. Dim oCylinder As Face oCylinder = oExtrusion1.SideFaces.Item(1) ' Creating Workplane Dim oWorkPlane As WorkPlane oWorkPlane = oPartDef.WorkPlanes.AddByPlaneAndOffset(oPartDef.WorkPlanes(1),oRadius) ' Creating a Sketch For Construction Dim sketch2 As PlanarSketch sketch2 = oPartDef.Sketches.Add(oWorkPlane) ' Projecting Centre Point Dim oProjectionPoint2 As SketchPoint oProjectionPoint2 = sketch2.AddByProjectingEntity(oPartDef.WorkPoints.Item(1)) ' Projecting Axis Dim oProjectAxis1 As SketchLine oProjectAxis1 = sketch2.AddByProjectingEntity(oPartDef.WorkAxes.Item(3)) oProjectAxis1.Construction = True ' Projecting End Faces of Cylinder Dim oProjectionline1 As SketchEntity oProjectionline1 = sketch2.AddByProjectingEntity(oExtrusion1.StartFaces.Item(1).Edges.Item(1)) Dim oProjectionline2 As SketchLine oProjectionline2 = sketch2.AddByProjectingEntity(oExtrusion1.EndFaces.Item(1).Edges.Item(1)) oProjectionline1.Construction = True oProjectionline2.Construction = True ' Collecting Data From EndUser to Get the Values of Starting Pitch Helix & Ending Pitch Helix Dim tempStartPitch As Double Dim oStartPitch As Double Dim tempEndPitch As Double Dim oEndPitch As Double tempStartPitch = InputBox("Enter The Starting Pitch of Helix", "Capricot", "10") oStartPitch = tempStartPitch/10 tempEndPitch = InputBox("Enter The Ending Pitch of Helix", "Capricot", "7") oEndPitch = tempEndPitch/10 Dim oCon(0 To 5) As CoincidentConstraint Dim oConstruct(0 To 5) As SketchLine ' Creating First Construction Line oConstruct1= sketch2.SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, -(oStartPitch)), tg.CreatePoint2d(-(oRadius*2*PI), -(oStartPitch))) Call sketch2.GeometricConstraints.AddHorizontal(oConstruct1) oConstruct1.Construction = True ' Adding Coincident Constraint to Projected Axis and StartSkecth point of First Construction Line oCon1 = sketch2.GeometricConstraints.AddCoincident(oProjectAxis1, oConstruct1.StartSketchPoint) ' Creating Second Construction Line oConstruct2= sketch2.SketchLines.AddByTwoPoints(oProjectionPoint2,oConstruct1.EndSketchPoint ) oConstruct2.Construction = True ' Creating Third Construction Line oConstruct3= sketch2.SketchLines.AddByTwoPoints(oProjectionLine2.StartSketchPoint,tg.CreatePoint2d(-(oRadius*2*PI*10),-(oLength) )) Call sketch2.GeometricConstraints.AddHorizontal(oConstruct3) oConstruct3.Construction = True ' Various Points For Placing Dimension Dim oTempPoint(0 To 7) As Double oTempPoint1 = (oRadius*2*PI*10)-(oRadius*2*PI) oTempPoint2 = (oRadius*2*PI*10)-((oRadius*2*PI)/2) oTempPoint3 = (OLength+2) oTempPoint4 = oLength-(oEndPitch/2) oTempPoint5 = (oRadius*2*PI*10)-((oRadius*2*PI)+2) oTempPoint6 = ((oRadius*2*PI*10)/2) oTempPoint7 = ((oLength)/2)+ 0.4 ' Creating Fourth Construction Line oConstruct4= sketch2.SketchLines.AddByTwoPoints(oConstruct3.EndSketchPoint,tg.CreatePoint2d(-(oTempPoint1),-(oLength-oEndPitch))) oConstruct4.Construction = True ' Creating FIfth & Last Construction Line oConstruct5= sketch2.SketchLines.AddByTwoPoints(oConstruct4.EndSketchPoint,tg.CreatePoint2d(-(oTempPoint1),-(oLength))) Call sketch2.GeometricConstraints.AddVertical(oConstruct5) oConstruct5.Construction = True oCon1 = sketch2.GeometricConstraints.AddCoincident(oConstruct3, oConstruct5.EndSketchPoint) Dim oDim(0 To 5) As TwoPointDistanceDimConstraint oDim1 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct1.StartSketchPoint,oConstruct1.EndSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d(-(oRadius*2*PI)/2, -(oStartPitch)-0.5)) oDim2 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct2.StartSketchPoint,oConstruct1.StartSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d((oRadius*2*PI)/2, (oStartPitch)-0.5)) oDim3 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct3.EndSketchPoint,oConstruct5.EndSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d(-oTempPoint2, -oTempPoint3)) oDim4 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct4.EndSketchPoint,oConstruct5.EndSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d(-oTempPoint5, -oTempPoint4)) Call sketch2.solve iLogicVb.UpdateWhenDone = True Dim oProjectArc As SketchArc oProjectArc = sketch2.SketchArcs.AddByThreePoints _ (oConstruct3.EndSketchPoint, tg.CreatePoint2d(-(oTempPoint6), -(oTempPoint7)),oConstruct2.StartSketchPoint) Dim oTan(0 To 2) As TangentConstraint oTan1 = sketch2.GeometricConstraints.AddTangent(oConstruct4,oProjectArc) oTan2 = sketch2.GeometricConstraints.AddTangent(oConstruct2,oProjectArc) oWorkPlane.Visible = False Call sketch2.solve iLogicVb.UpdateWhenDone = True Dim sketch3 As sketch3D sketch3 = oPartDef.Sketches3D.Add End Sub
Hi Ravi,
I'm afraid I have bad news for you. The equivalent of the "Project to Surface" command is not currently supported by the API so this is not possible to automate. The API should support it and it would be useful functionality but it currently does not.
Thanks For ur Response
The API should support it and it would be useful functionality but it currently does not.
Will it be available in upcoming Release?
i have completed this code until here
SyntaxEditor Code Snippet
Sub Main() ' Defining This Document Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument 'Definining a Component Definition Dim oPartDef As PartComponentDefinition oPartDef = oPartDoc.ComponentDefinition Dim oParams As Parameters oParams = oPartDef.Parameters ' Create a 2D sketch on the X-Y plane. Dim sketch1 As PlanarSketch sketch1 = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(3)) sketch1.Name = "Sketch_For_Cylinder_Helix" 'Collecting Transient Geometry Dim tg As TransientGeometry tg = ThisApplication.TransientGeometry ' Create's a Projected Centre Point Dim oProjectionPoint1 As SketchPoint oProjectionPoint1 = sketch1.AddByProjectingEntity(oPartDef.WorkPoints.Item(1)) ' Converting cm to mm Dim tempRadius As Double Dim oRadius As Double tempRadius = InputBox("Enter The Radius of Helix", "Capricot", "10") oRadius = tempRadius/10 ' Create a circle Dim oCircle1 As SketchCircle oCircle1 = sketch1.SketchCircles.AddByCenterRadius(tg.CreatePoint2d(0, 0),oRadius) Call oCircle1.CenterSketchPoint.Merge(oProjectionPoint1) 'Dimensioning a circle Dim oDimCircle As DiameterDimConstraint oDimCircle = sketch1.DimensionConstraints.AddDiameter(oCircle1, tg.CreatePoint2d(0, (oRadius*2))) oDimCircle.Parameter.Name = "Dia_Of_Helix" oDimCircle.Parameter.Comment = "Diameter of Helix" Dim tempLength As Double Dim oLength As Double tempLength = InputBox("Enter The Length of Helix", "Capricot", "60") oLength = tempLength/10 ' Create a solid extrusion. Dim oProfile As Profile oProfile = sketch1.Profiles.AddForSolid Dim oExtrudeDef1 As ExtrudeDefinition oExtrudeDef1 = oPartDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kNewBodyOperation) Call oExtrudeDef1.SetDistanceExtent(oLength, kNegativeExtentDirection) Dim oExtrusion1 As ExtrudeFeature oExtrusion1 = oPartDef.Features.ExtrudeFeatures.Add(oExtrudeDef1) oExtrusion1.Name = "Cylinder_For_Helix_Wound" Dim ExtrudeFeatDistExtent As DistanceExtent ExtrudeFeatDistExtent = oExtrusion1.Extent ExtrudeFeatDistExtent.Distance.Name = "Len_Of_Helix" ExtrudeFeatDistExtent.Distance.Comment = "Length of the Entire Helix " oExtrusion1.TaperAngle.Name = "Cylinder_Taper" ' Get the cylindrical face of the solid. Dim oCylinder As Face oCylinder = oExtrusion1.SideFaces.Item(1) ' Creating Workplane Dim oWorkPlane As WorkPlane oWorkPlane = oPartDef.WorkPlanes.AddByPlaneAndOffset(oPartDef.WorkPlanes(1),(oRadius)) oWorkPlane.Name = "Plane_For_Construct" oWorkPlane.Definition.Offset.Name = "Construct_Sketch_Plane" oWorkPlane.Definition.Offset.Expression = "=Dia_Of_Helix/2" ' Creating a Sketch For Construction Dim sketch2 As PlanarSketch sketch2 = oPartDef.Sketches.Add(oWorkPlane) sketch2.Name = "Construction_Sketch" ' Projecting Centre Point Dim oProjectionPoint2 As SketchPoint oProjectionPoint2 = sketch2.AddByProjectingEntity(oPartDef.WorkPoints.Item(1)) ' Projecting Axis Dim oProjectAxis1 As SketchLine oProjectAxis1 = sketch2.AddByProjectingEntity(oPartDef.WorkAxes.Item(3)) oProjectAxis1.Construction = True ' Projecting End Faces of Cylinder Dim oProjectionline1 As SketchEntity oProjectionline1 = sketch2.AddByProjectingEntity(oExtrusion1.StartFaces.Item(1).Edges.Item(1)) Dim oProjectionline2 As SketchLine oProjectionline2 = sketch2.AddByProjectingEntity(oExtrusion1.EndFaces.Item(1).Edges.Item(1)) oProjectionline1.Construction = True oProjectionline2.Construction = True ' Collecting Data From EndUser to Get the Values of Starting Pitch Helix & Ending Pitch Helix Dim tempStartPitch As Double Dim oStartPitch As Double Dim tempEndPitch As Double Dim oEndPitch As Double tempStartPitch = InputBox("Enter The Starting Pitch of Helix", "Capricot", "10") oStartPitch = tempStartPitch/10 tempEndPitch = InputBox("Enter The Ending Pitch of Helix", "Capricot", "7") oEndPitch = tempEndPitch/10 Dim oCon(0 To 5) As CoincidentConstraint Dim oConstruct(0 To 5) As SketchLine ' Creating First Construction Line oConstruct1= sketch2.SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, -(oStartPitch)), tg.CreatePoint2d(-(oRadius*2*PI), -(oStartPitch))) Call sketch2.GeometricConstraints.AddHorizontal(oConstruct1) oConstruct1.Construction = True ' Adding Coincident Constraint to Projected Axis and StartSkecth point of First Construction Line oCon1 = sketch2.GeometricConstraints.AddCoincident(oProjectAxis1, oConstruct1.StartSketchPoint) ' Creating Second Construction Line oConstruct2= sketch2.SketchLines.AddByTwoPoints(oProjectionPoint2,oConstruct1.EndSketchPoint ) oConstruct2.Construction = True ' Creating Third Construction Line oConstruct3= sketch2.SketchLines.AddByTwoPoints(oProjectionLine2.StartSketchPoint,tg.CreatePoint2d(-(oRadius*2*PI*10),-(oLength) )) Call sketch2.GeometricConstraints.AddHorizontal(oConstruct3) oConstruct3.Construction = True ' Various Points For Placing Dimension Dim oTempPoint(0 To 7) As Double oTempPoint1 = (oRadius*2*PI*10)-(oRadius*2*PI) oTempPoint2 = (oRadius*2*PI*10)-((oRadius*2*PI)/2) oTempPoint3 = (OLength+2) oTempPoint4 = oLength-(oEndPitch/2) oTempPoint5 = (oRadius*2*PI*10)-((oRadius*2*PI)+2) oTempPoint6 = ((oRadius*2*PI*10)/2) oTempPoint7 = ((oLength)/2)+ 0.4 ' Creating Fourth Construction Line oConstruct4= sketch2.SketchLines.AddByTwoPoints(oConstruct3.EndSketchPoint,tg.CreatePoint2d(-(oTempPoint1),-(oLength-oEndPitch))) oConstruct4.Construction = True ' Creating FIfth & Last Construction Line oConstruct5= sketch2.SketchLines.AddByTwoPoints(oConstruct4.EndSketchPoint,tg.CreatePoint2d(-(oTempPoint1),-(oLength))) Call sketch2.GeometricConstraints.AddVertical(oConstruct5) oConstruct5.Construction = True oCon1 = sketch2.GeometricConstraints.AddCoincident(oConstruct3, oConstruct5.EndSketchPoint) Dim oDim(0 To 5) As TwoPointDistanceDimConstraint oDim1 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct1.StartSketchPoint,oConstruct1.EndSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d(-(oRadius*2*PI)/2, -(oStartPitch)-0.5)) oDim1.Parameter.Name = "Dia_X_PI" oDim1.Parameter.Comment = "Perimeter of Dia oF Helix Defined for Start Pitch of Helix" oDim2 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct2.StartSketchPoint,oConstruct1.StartSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d((oRadius*2*PI)/2, (oStartPitch)-0.5)) oDim2.Parameter.Name = "Startpitch_Of_Helix" oDim2.Parameter.Comment = "User Specifies a Starting Pitch of Helix" oDim3 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct3.EndSketchPoint,oConstruct5.EndSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d(-oTempPoint2, -oTempPoint3)) oDim3.Parameter.Name = "Dia_X_PI_1" oDim3.Parameter.Expression = "Dia_X_PI" oDim3.Parameter.Comment = "Perimeter of Dia oF Helix Defined for End Pitch of Helix" oDim4 = sketch2.DimensionConstraints.AddTwoPointDistance _ (oConstruct4.EndSketchPoint,oConstruct5.EndSketchPoint,DimensionOrientationEnum.kAlignedDim,tg.CreatePoint2d(-oTempPoint5, -oTempPoint4)) oDim4.Parameter.Name = "Endpitch_Of_Helix" oDim2.Parameter.Comment = "User Specifies a Endinging Pitch of Helix" Call sketch2.solve iLogicVb.UpdateWhenDone = True Dim oProjectArc As SketchArc oProjectArc = sketch2.SketchArcs.AddByThreePoints _ (oConstruct3.EndSketchPoint, tg.CreatePoint2d(-(oTempPoint6), -(oTempPoint7)),oConstruct2.StartSketchPoint) Dim oTan(0 To 2) As TangentConstraint oTan1 = sketch2.GeometricConstraints.AddTangent(oConstruct4,oProjectArc) oTan2 = sketch2.GeometricConstraints.AddTangent(oConstruct2,oProjectArc) oWorkPlane.Visible = False Call sketch2.solve iLogicVb.UpdateWhenDone = True Dim sketch3 As sketch3D sketch3 = oPartDef.Sketches3D.Add End Sub
i have also tried by an Equation Curves3D
but even its not working for some reason
VBA Example which is povided in APi examples is not working For me
But Even then it is very difficult to control StartPitch and End Pitch of Helix
here is the VBA Example
I'm not able to comment on future functionality but to better the chances of this making it into a future release it's best to make your wishes known by using the Inventor IdeaStation. This way, those that decide where to spend the resources each release will know of your needs.
Regarding your code, there seems to be a lot of problems in the code itself. I'm assuming it's VB.Net code because there aren't any Set statements when you're making assignments. You declare arrays
Dim oConstruct(0 to 5) as SketchLine
but then try to use them like this:
oConstruct1 = ...
It should be
oConstruct(1) = ...
If it is a VB.Net program, ThisApplication doesn't exist. Also pi isn't defined anywhere. If it is a VB.Net program you can use Math.PI.
Its Not Vb.net code
i am Straight away using in Ilogic
Any Programmes First i will try to run in VBA or Ilogic
Later on i ask My Engineers to Convert it to an addin
i Dont have Much Experience in Vb.net
Actually you do have experience in VB.Net because that's what iLogic is using. I think you would find it much easier to do your initial development in VB.Net rather than iLogic because then you'll immediately see all of the errors and be able to use the very good debugging capabilities of Visual Studio. VBA is also a good tool for initial prototyping. iLogic would be my last choice because of the editor and lack of debugging.
iLogic is Betterway For My company Needs
Bec EndUser Can alter Rule For His needs Later
VB.Net could be Better
But My Boss does'nt allow me to work in VB.Net
He ask some other Engineers to develop addins
Those Engineers Rarely Use Inventor
Variable Helix
Creating Helix with the use of 3D Equation Curve (SketchEquationCurves3D)
This feature is not a Parameteric Feature
Example
radius = 3 or 3*t
num_turns = 5
height = 10
pitch = 2 or 2*t
t ranges from 0 to 1.
Cylindrical coordinates:
r(t) = 3
theta(t) = 360*5*t
z(t) = 5*2*t
Cylindrical coordinates:
r(t) = 3
theta(t) = 360*5*t
z(t) = 5*2*t*t
Cylindrical coordinates:
r(t) = 3*t
theta(t) = 360*5*t
z(t) = 5*2*t
Cylindrical coordinates:
r(t) = 3*t
theta(t) = 360*5*t
z(t) = 5*2*t*t
Radius 3 mm Should be available in Fx parameter for Future editing
But it Doesn't Why?
i have Created a iLogic Rule
it creates a user Parameter Type_Of_Helix withmultivalue List
Where user selects a Type of helix on Input List Box
then the helix will Creates via Api
here is the ILogic Rule ,Part and Video
And one More Question How do i constraint These Curves after Creation
The original Link
Method of Creating Helix with 3D EQuation Curve Command
Equation driven curves don't create parameters for their inputs except for tMin and tMax. However you can still accomplish what you want by creating your own parameter and then referencing it in the curve equation. For example, you can create a parameter called "Radius" and then use it when defining r(t) you can use "Radius" instead of "3". Changing the value of Radius will cause the curve to recompute. You can use existing parameter names for any of the curve inputs.
About your question about constraining the curve, you don't constrain equation driven curves because they're already fully defined by the equation. You can however connect other standard sketch curves to these curves using constraints.
Here's a version of your program that does just that.
Sub Main() Dim partDoc As PartDocument = ThisApplication.ActiveDocument Dim oParams As Parameters oParams = partDoc.ComponentDefinition.Parameters Dim oUserParams As UserParameters oUserParams = oParams.UserParameters ' Check to see if "Radius" exists and create it if it doesn't. Try Dim radParam As UserParameter = oUserParams.Item("Radius") Catch ex As Exception oUserParams.AddByExpression("Radius", "3", _ Inventor.UnitsTypeEnum.kDefaultDisplayLengthUnits) End Try Const_Radius_And_Const_Pitch(partDoc.ComponentDefinition) Const_Radius_And_Vari_Pitch(partDoc.ComponentDefinition) Vari_Radius_And_Const_Pitch(partDoc.ComponentDefinition) Vari_Radius_And_Vari_Pitch(partDoc.ComponentDefinition) End Sub Sub Const_Radius_And_Const_Pitch(partDef As PartComponentDefinition) 'Creating a 3D Sketch Dim oSketch1 As Sketch3D oSketch1 = partDef.Sketches3D.Add Dim equationCurve2 As SketchEquationCurve3D equationCurve2 = oSketch1.SketchEquationCurves3D.Add( _ CoordinateSystemTypeEnum.kCylindrical, _ "Radius", "360*5*t", "5*2*t", 0, 1) ThisApplication.ActiveView.Fit() End Sub Sub Const_Radius_And_Vari_Pitch(partDef As PartComponentDefinition) 'Creating a 3D Sketch Dim oSketch1 As Sketch3D oSketch1 = partDef.Sketches3D.Add Dim equationCurve2 As SketchEquationCurve3D equationCurve2 = oSketch1.SketchEquationCurves3D.Add( _ CoordinateSystemTypeEnum.kCylindrical, _ "Radius", "360*5*t", "5*2*t*t", 0, 1) ThisApplication.ActiveView.Fit() End Sub Sub Vari_Radius_And_Const_Pitch(partDef As PartComponentDefinition) 'Creating a 3D Sketch Dim oSketch1 As Sketch3D oSketch1 = partDef.Sketches3D.Add Dim equationCurve2 As SketchEquationCurve3D equationCurve2 = oSketch1.SketchEquationCurves3D.Add( _ CoordinateSystemTypeEnum.kCylindrical, _ "Radius*t", "360*5*t", "5*2*t", 0, 1) ThisApplication.ActiveView.Fit() End Sub Sub Vari_Radius_And_Vari_Pitch(partDef As PartComponentDefinition) 'Creating a 3D Sketch Dim oSketch1 As Sketch3D oSketch1 = partDef.Sketches3D.Add Dim equationCurve2 As SketchEquationCurve3D equationCurve2 = oSketch1.SketchEquationCurves3D.Add( _ CoordinateSystemTypeEnum.kCylindrical, _ "Radius*t", "360*5*t", "5*2*t*t", 0, 1) ThisApplication.ActiveView.Fit() End Sub
I've never used an iLogic input box but I assume you can get the values the user has entered. Then you will need to create parameters using those values and you can use the names of those parameters when defining the equations for the curve. The biggest issue will be creating unique names for your parameters. For example, if they run your program twice and you want the radius (and other values) of each helix to be driven independently of the other you'll need to have unique parameters for each helix, i.e. Radius1, Radius2, etc.
There isn't anything built into the API to create unique names. There are a couple of approaches to solve this. The first is to do something similar to what I did in the previous sample where it's checking to see if the parameter "Radius" exists and you go into a loop checking if a name is used and once it's not then you know that name is available.
The other option is more elegent but more work. You could create an attribute in the document with the current count. Each time you need to create a helix you use that count to append to the parameter name and increment the count.
Finally i have Finished This Code
Thanks Brain
Then
it asks user to input
Radius
No of rev
height
Pitch will be calculated =(Height/No of revoultions)
First
user has to select one out of Four choices
Then it Creates a helix
Then
it asks user to input
Radius
No of rev
height
Pitch will be calculated =(Height/No of revoultions)
User Parameter are Created With Radius,height,No Of Turns and Pitch
For Future Editing
Then Creates an Helix
here is the Code
https://www.dropbox.com/s/dmdniicpotdgnpf/Untitled.gif?dl=0
Hi,
Are you all set then? 🙂
Can you mark it somewhere as solved?
Thank you,
Hi @adam.nagy, @ekinsb
I thought I would reply here and ask the same question in case my earlier tweet gets lost in the ether or anyone else wants to know; have there been any additions to the API on this subject?
Thanks,
Alex.
Hi Alex,
I'm told there is still no API for it. 😞
Please do vote for it on the IdeaStation though - that could help:
Cheers,
Is this API Feature Added in 2018