Inventor Customization

Inventor Customization

Reply
Active Contributor
jpchaisson
Posts: 28
Registered: ‎09-28-2011
Message 1 of 9 (454 Views)

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

454 Views, 8 Replies
11-05-2011 12:09 PM

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?

Mentor
krieg
Posts: 176
Registered: ‎11-22-2009
Message 2 of 9 (443 Views)

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

11-06-2011 02:38 PM in reply to: jpchaisson

Hi

 

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

Active Contributor
jpchaisson
Posts: 28
Registered: ‎09-28-2011
Message 3 of 9 (433 Views)

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

11-08-2011 02:15 PM in reply to: krieg

can you show me a example of using that method?

Active Contributor
jpchaisson
Posts: 28
Registered: ‎09-28-2011
Message 4 of 9 (419 Views)

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

11-09-2011 09:27 AM 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?

Mentor
krieg
Posts: 176
Registered: ‎11-22-2009
Message 5 of 9 (415 Views)

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

11-09-2011 09:50 AM 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.
Active Contributor
jpchaisson
Posts: 28
Registered: ‎09-28-2011
Message 6 of 9 (410 Views)

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

11-09-2011 10:21 AM in reply to: 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???

Mentor
krieg
Posts: 176
Registered: ‎11-22-2009
Message 7 of 9 (399 Views)

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

11-09-2011 01:39 PM in reply to: jpchaisson

Hello

 

Try

 

Dim oANG1 As String
oANG1 = "30 grd"

 

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

Active Contributor
jpchaisson
Posts: 28
Registered: ‎09-28-2011
Message 8 of 9 (397 Views)

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

11-09-2011 02:00 PM in reply to: krieg

Thank you so much its working great now.

 

can you explain what the "grd" means ?

 

 

Mentor
krieg
Posts: 176
Registered: ‎11-22-2009
Message 9 of 9 (394 Views)

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

11-09-2011 02:10 PM 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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.