ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Aligning blocks along a path of the curve

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
cadsindiaadn
787 Views, 3 Replies

Aligning blocks along a path of the curve

Hello,
I am looking for a solution to place few blocks along a curve. The blocks need to be aligned in the direction of the curve. This is exactly the same thing done in AutoCAD "Divide" command with "align" option. I would like to achieve this behaviour through ObjectARX API.

I know how to divide a curve through the methods available in AcDbCurve class. But I don't know how to align(rotate) the blocks along the path. Can you guide me with any samples?

Thanks
PremKumar U

Tags (2)
3 REPLIES 3
Message 2 of 4
owenwengerd
in reply to: cadsindiaadn

You can use AcDbBlockReference::transformBy() to align a block reference entity to your alignment vector by creating a transformation matrix based on the vector. I don't have any sample code available, but it's not too difficult to figure out by reviewing the API documentation.

--
Owen Wengerd
ManuSoft
Message 3 of 4
cadsindiaadn
in reply to: owenwengerd

Hi Owen,

 

Thanks for stepping in to reply. Greatly appreciate it.

 

In the first post, the actual problem is to how to find the transformation -or- the rotation angle -or- alignment vector. 

 

I can think of two possible ways to find it, which I am only conceptually aware of:

 

  1. If a centre of a closed polygon can be found, the relative angle of rotation can be found based on the insertion point of the current block on the divided polygon and the centre.  But this is not quite simple when it is a open spline curve.
  2. The other way is to find the differnece in angle of tangents at the insertion points and use that for computing the rotation angle.

I asked the question so that I should not reinvent the wheel, if any (or better) solution exist.  Even for the solutions I said above, I do not know how to implement it as well. It would be of immense help if any existing API function can do or any sample code exist.

 

Many thanks,

Premkumar

Message 4 of 4
owenwengerd
in reply to: cadsindiaadn

You can call AcDbCurve::getFirstDeriv() to get the alignment vector.

--
Owen Wengerd
ManuSoft

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

Post to forums  

Autodesk Design & Make Report

”Boost