Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

transformBy?No action

1 REPLY 1
SOLVED
Reply
Message 1 of 2
463017170
316 Views, 1 Reply

transformBy?No action

static void msddMyGroupMyCommand () {
	ads_name ent;
	ads_point pt;
	AcDbObjectId id0;
	acedEntSel(_T("\nSelect Object"), ent, pt);
	acdbGetObjectId(id0, ent);

	AcGePoint3d startPoint;
	AcGeVector3d  XDir, YDir, ZDir;

	startPoint.set(1000, 1000, 0);

	XDir.set(0.7071  , 0.4082 ,  -0.5774 );
    YDir.set(-0.7071 , 0.4082 ,  -0.5774 );
    ZDir.set(0,         0.8165,   0.5774 );

	AcGeMatrix3d xform;

	xform.setCoordSystem(startPoint, XDir,YDir,ZDir);

	AcDbEntity *pEnt;
	Acad::ErrorStatus es = acdbOpenObject(pEnt, id0, AcDb::kForWrite,false);
	pEnt->transformBy(xform);
	pEnt->close();
}
1 REPLY 1
Message 2 of 2
tbrammer
in reply to: 463017170

You should look at the return value of

 

es = pEnt->transformBy(xform);

 

Your xform is not a pure rotation matrix. It also contains scaling with different factors.
The scale factors are the lenghts of the vectors XDir, YDir and ZDir. 

They are 0.912822 for XDir and YDir but  1.15471 for ZDir.

Most entities don't support scaling with different scale factors.

Also the vectors are not exactly perpendicular to each other. Calculating the dotproducts yield:

XDir * YDir = 2.759 e-5
YDir * ZDir = XDir * ZDir  = -9.546 e-5


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report