.NET

## .NET

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

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

144 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*
Posts: 2,077
Registered: ‎04-29-2006
Message 2 of 3 (126 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
Posts: 46
Registered: ‎05-18-2007
Message 3 of 3 (105 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

### You are not logged in.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.