.NET

.NET

Reply
Active Contributor
dancalgary
Posts: 46
Registered: ‎05-18-2007
Message 1 of 3 (162 Views)

I want to insert a 3d block into into a ucs

162 Views, 2 Replies
08-24-2013 10:41 PM

Hi,

a stupid question:

I defined a 3d block

It is defined along X axis

I want to insert it into a ucs by picking 2 points( insertion, and direction) and that Block Z axis to be parallel with UCS z axis

I insert the block first then I rotated it

I have got this code:

 

P1 is insertion poit

P2 is the point for direction

 

P1 world is p1.transformby(current ucs)

 

Dim Xax_block As Vector3d = Block1.BlockTransform.CoordinateSystem3d.Xaxis.TransformBy(Block1.BlockTransform)

 Dim VectorP12 As Vector3d = P1_world.GetVectorTo(P2_world)
    Dim RotAX As Vector3d = Xax_block.CrossProduct(VectorP12) ' here is calculating the perpendicular vector between x axis of the block and the vector from point1 and point2

 

      Dim Rotation1 As Double = Xax_block.GetAngleTo(VectorP12)
      Block1.TransformBy(Matrix3d.Rotation(Rotation1, RotAX, P1_world))

 

This code i found it on this forum

By picking 2 points is inserting the block along the line between 2 points

But is not having as normal the z axis of the ucs....

 

Can you point me to the right direction?

 

Thanks

 

*Expert Elite*
_gile
Posts: 2,125
Registered: ‎04-29-2006
Message 2 of 3 (144 Views)

Re : I want to insert a 3d block into into a ucs

08-25-2013 05:00 AM in reply to: dancalgary

Hi,

 

Perhaps you can get some inspiration from this thread:

http://www.theswamp.org/index.php?topic=39891.0

Gilles Chanteau
Active Contributor
dancalgary
Posts: 46
Registered: ‎05-18-2007
Message 3 of 3 (123 Views)

Re : I want to insert a 3d block into into a ucs

08-25-2013 06:11 PM in reply to: _gile

thanks - worked

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.