.NET

.NET

Reply
Active Contributor
46 Posts
1 Kudo
Registered: ‎05-18-2007
Post 1 of 3

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

169 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*
2,142 Posts
255 Kudos
Registered: ‎04-29-2006
Post 2 of 3

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
46 Posts
1 Kudo
Registered: ‎05-18-2007
Post 3 of 3

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
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!