IM trying to scale all graphical elements by a factor about 0,0,0 point.
i see posts on this forum for doing this from the COM side and c++ side but not .net.
any help looks like i need to use the TransformInfo but unsure how to set it.
ModelElementsCollection graphicalElements = curModel.GetGraphicElements();
foreach(Bentley.DgnPlatformNET.Elements.Element curElement in graphicalElements)
Bentley.DgnPlatformNET.TransformInfo transformInfo = new TransformInfo();
//set scale and origin
John Drsek said:any help looks like i need to use the TransformInfo but unsure how to set it.
it's not complicated, but crucial, because TransformInfo is a core structure for all types of transformations ;-)
Code not tested, just copied and modified a bit:
double scale = 1.2345;
DTransform3d dTransform3D = DTransform3d.Scale(scale);
TransformInfo transformInfo = new TransformInfo(dTransform3D);
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: John Drsek
so is it scaling about 0,0 by default?
and do i have to write the element after the transform?
John Drsek said:so is it scaling about 0,0 by default?
If an object is located at point x,y then you must
John Drsek said:do i have to write the element after the transform?
Rewrite, not write. You want to modify an existing element, not create a new one.
Regards, Jon Summers LA Solutions
in addition to Jon's answer:
All transformations (scale, rotation, skew...) are always calculated against 0,0, 0.
When discussion the rotation, it's always around the origin, so as Jon wrote, when you want to rotate around other point, you must move element to the origin, rotate it and move it back.
In API, because transformation matrices can be "summed" (the order is crucial, because for matrices A x B != B x A), one TransformInfo can be created and applied to the element.
John Drsek said:and do i have to write the element after the transform?
To be exact, to "rewrite element" means ReplaceInModel() method.