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: 

Please Help!!! - Rotate new Workplane along a default Axis With API

8 REPLIES 8
Reply
Message 1 of 9
jpchaisson
865 Views, 8 Replies

Please Help!!! - Rotate new Workplane along a default Axis With API

How do you create a new Workplane from a Defualt Plane and rotate it along a default Axis?

 

I am new to API and trying to create workplanes and rotate them along a Axis.

 

Im trying to use "AddByPlaneAndOffset" is this the right method?

8 REPLIES 8
Message 2 of 9
Ralf_Krieg
in reply to: jpchaisson

Hi

 

No, AddByPlaneAndOffset allows only a plane parallel to the source plane. Use SetByLinePlaneAndAngle instead.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 3 of 9
jpchaisson
in reply to: Ralf_Krieg

can you show me a example of using that method?

Message 4 of 9
jpchaisson
in reply to: jpchaisson

ok i have it working, but my angle isnt coming out right. how do i set the angle as a Object?

Message 5 of 9
Ralf_Krieg
in reply to: jpchaisson

Hi

 

Sorry, couldn't provide the example at work. Now at home I'm too late.

 

The angle, if provided as numeric value without dimension is interpreted as radiant !

 

From developers help:

 

Input Variant that defines the offset angle of the work plane from the input plane. This can be a numeric value or a string. The offset angle of a work plane is always defined by a parameter. When a new work plane is created, the parameter is automatically created. If a numeric value is supplied the new parameter is set to the value specified and the value is always in radians. If a string is supplied it is used as the expression for the newly created parameter and will be interpreted the same as if the user entered it in a dialog. This means if a value is specified without a unit qualifier it will default to the current document length unit. The following is a valid entry for the angle, assuming the parameter d2 already exists and defines an angle, 'd2 + 10 deg'. The positive angle direction is computed by crossing the axis vector with the plane normal vector.

R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 6 of 9
jpchaisson
in reply to: Ralf_Krieg

thank you for responding, i think i understand what you are saying heres my code for a more visual.

 

 

       

Dim oPartDoc As PartDocument  

Dim oPartCompDef As PartComponentDefinition       

Dim BaseXY As WorkPlane       

Dim AxisX As WorkAxis      

Dim oANG1 As Double

 

           oPartDoc = oApp.ActiveDocument

        oPartCompDef = oPartDoc.ComponentDefinition

        BaseXY = oPartCompDef.WorkPlanes.Item(3)

        AxisX = oPartCompDef.WorkAxes.Item(1)

        oANG1 = "30"

 

        oPartCompDef.WorkPlanes.AddByLinePlaneAndAngle(AxisX, BaseXY, oANG1)

 

what am i doing wrong my workplane ends up being a 2.xxxxxxx deg angle???

Message 7 of 9
Ralf_Krieg
in reply to: jpchaisson

Hello

 

Try

 

Dim oANG1 As String
oANG1 = "30 grd"

 

Your code means an angle of 30 radiant = 1718,8733853925°.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 8 of 9
jpchaisson
in reply to: Ralf_Krieg

Thank you so much its working great now.

 

can you explain what the "grd" means ?

 

 

Message 9 of 9
Ralf_Krieg
in reply to: jpchaisson

Hi

 

"grd" means just grad or degrees or ° and is the unit of angle value. Take a look at your fx-Parameters after creating your workplane and the new parameter for the angle.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com

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

Post to forums  

Autodesk Design & Make Report