.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
*Carlos Cabrera
TransformB y Error: eCannotSca leNonUnifo rmly
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
533 Views, 2 Replies
09-14-2005 01:57 PM
What is the proper way to orient a block to any desired orientation?
I've got two vectors for the block's desired X and Y directions with respect
to the WCS, but my TransformBy method only works if they lie along an
existing axis. For example, if they are (0,1,0) and (1,0,0) everything
works great. But if I rotate the block by 45 degrees, the vectors X=(1,0,0)
and Y=(0,0.7071,0.7071) produce an eCannotScaleNonUniformly error.
Here's my C# code (AutoCAD 2006):
Point3d origin = new Point3d(0, 0, 0);
// Set the new location and orientation vectors
Point3d location = new Point3d(0, 20, 10);
Vector3d xVector = new Vector3d(1, 0, 0);
Vector3d yVector = new Vector3d(0, 0.7071, 0.7071);
// Rotate it
Vector3d oldX = new Vector3d(1, 0, 0);
Vector3d oldY = new Vector3d(0, 1, 0);
Vector3d oldZ = new Vector3d(0, 0, 1);
Matrix3d m = Matrix3d.AlignCoordinateSystem(origin, oldX, oldY, oldZ,
location, xVector, yVector, xVector.CrossProduct(yVector));
bref.TransformBy(m);
I've got two vectors for the block's desired X and Y directions with respect
to the WCS, but my TransformBy method only works if they lie along an
existing axis. For example, if they are (0,1,0) and (1,0,0) everything
works great. But if I rotate the block by 45 degrees, the vectors X=(1,0,0)
and Y=(0,0.7071,0.7071) produce an eCannotScaleNonUniformly error.
Here's my C# code (AutoCAD 2006):
Point3d origin = new Point3d(0, 0, 0);
// Set the new location and orientation vectors
Point3d location = new Point3d(0, 20, 10);
Vector3d xVector = new Vector3d(1, 0, 0);
Vector3d yVector = new Vector3d(0, 0.7071, 0.7071);
// Rotate it
Vector3d oldX = new Vector3d(1, 0, 0);
Vector3d oldY = new Vector3d(0, 1, 0);
Vector3d oldZ = new Vector3d(0, 0, 1);
Matrix3d m = Matrix3d.AlignCoordinateSystem(origin, oldX, oldY, oldZ,
location, xVector, yVector, xVector.CrossProduct(yVector));
bref.TransformBy(m);
Re: TransformB y Error: eCannotSca leNonUnifo rmly
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-16-2005 05:18 AM in reply to:
*Carlos Cabrera
You have to translate, scale, then rotate in that order.
It is easier just to set the Position, Rotation and Scale Factor properties.
Chris Arps
It is easier just to set the Position, Rotation and Scale Factor properties.
Chris Arps
*Albert Szilvasy
Re: TransformB y Error: eCannotSca leNonUnifo rmly
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-16-2005 03:29 PM in reply to:
*Carlos Cabrera
I suspect the problem is precision. 0.7071 is not exactly cos(45 degrees)
Albert
"Carlos Cabrera" wrote in message
news:4956633@discussion.autodesk.com...
What is the proper way to orient a block to any desired orientation?
I've got two vectors for the block's desired X and Y directions with respect
to the WCS, but my TransformBy method only works if they lie along an
existing axis. For example, if they are (0,1,0) and (1,0,0) everything
works great. But if I rotate the block by 45 degrees, the vectors X=(1,0,0)
and Y=(0,0.7071,0.7071) produce an eCannotScaleNonUniformly error.
Here's my C# code (AutoCAD 2006):
Point3d origin = new Point3d(0, 0, 0);
// Set the new location and orientation vectors
Point3d location = new Point3d(0, 20, 10);
Vector3d xVector = new Vector3d(1, 0, 0);
Vector3d yVector = new Vector3d(0, 0.7071, 0.7071);
// Rotate it
Vector3d oldX = new Vector3d(1, 0, 0);
Vector3d oldY = new Vector3d(0, 1, 0);
Vector3d oldZ = new Vector3d(0, 0, 1);
Matrix3d m = Matrix3d.AlignCoordinateSystem(origin, oldX, oldY, oldZ,
location, xVector, yVector, xVector.CrossProduct(yVector));
bref.TransformBy(m);
Albert
"Carlos Cabrera"
news:4956633@discussion.autodesk.com...
What is the proper way to orient a block to any desired orientation?
I've got two vectors for the block's desired X and Y directions with respect
to the WCS, but my TransformBy method only works if they lie along an
existing axis. For example, if they are (0,1,0) and (1,0,0) everything
works great. But if I rotate the block by 45 degrees, the vectors X=(1,0,0)
and Y=(0,0.7071,0.7071) produce an eCannotScaleNonUniformly error.
Here's my C# code (AutoCAD 2006):
Point3d origin = new Point3d(0, 0, 0);
// Set the new location and orientation vectors
Point3d location = new Point3d(0, 20, 10);
Vector3d xVector = new Vector3d(1, 0, 0);
Vector3d yVector = new Vector3d(0, 0.7071, 0.7071);
// Rotate it
Vector3d oldX = new Vector3d(1, 0, 0);
Vector3d oldY = new Vector3d(0, 1, 0);
Vector3d oldZ = new Vector3d(0, 0, 1);
Matrix3d m = Matrix3d.AlignCoordinateSystem(origin, oldX, oldY, oldZ,
location, xVector, yVector, xVector.CrossProduct(yVector));
bref.TransformBy(m);

