AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA - supplied rotation angle not displaying correctly

1 REPLY 1
Reply
Message 1 of 2
geoschema
1525 Views, 1 Reply

VBA - supplied rotation angle not displaying correctly

Hi,

I'm trying to insert a block with a given rotation angle, however the angle it rotates is no where near the supplied rotation.

 

here is the command:

 

rotAng = 126.65418256

Set blockobj = ThisDrawing.ModelSpace.InsertBlock(inPt, "NorthArrow", 1, 1, 1, rotAng)

 

The block in placed in the proper inserted position, but the angle is not 126.65418256

Through properties dialog Box-- rotation of place block = 33.24988163

Units are set to:

Decimal Deg

Clockwise

Direction = North

 

What the ??? is happening?

 

If I insert the block via the command line and provide this angle at the command line , the block is place at the desired orientation.

If I use the following code:

blockobj.Rotate inPt, ThisDrawing.Utility.GetAngle(inPt, "Select Rotation Angle:") ....getting user supplied angle

the block rotates to the desired orientation.

But, passing the angle to these functions results in undesirable orientation......... consistent but in err

 

System

ACAD Map 3D 2012 on Win 7 Pro  also ACAD Map 3D 2012 on Win XP sp3

Installed VBA Enabler

 

 Any thoughts??

1 REPLY 1
Message 2 of 2
Alfred.NESWADBA
in reply to: geoschema

Hi,

 

the UNITS-setting is not important for development, because if you have something to do with angles, it's always based on radiant.

So you have to recalc your degree-angle to radiant:

 

126.65418256 / 180.0 * Math.PI

 

For settings like north-direction and counterclockwise ... you have to prepare your angle 126.65.. before converting to radiant.

AutoCAD always calculates

  • 0 ==> shows to east
  • Math.PI shows to north (so angle is calculated counterclockwise)

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)

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

Post to forums  

Autodesk Design & Make Report

”Boost