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

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

2 REPLIES 2
Reply
Message 1 of 3
dancalgary
342 Views, 2 Replies

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

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

 

2 REPLIES 2
Message 2 of 3
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 3
dancalgary
in reply to: _gile

thanks - worked

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost