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
Hi,
Perhaps you can get some inspiration from this thread: