Change the reference point of an entity.

KernelCAD with Native Visual Basic
Post Reply
juergen
Posts: 6
Joined: Wed Jan 10, 2024 9:35 am

Change the reference point of an entity.

Post by juergen »

How can I change the reference of an entity, e.g. to simplify rotations?
For example, a StdShape.Box has its reference from the beginning at the corner (X=0,Y=0,Z=0).
How can I move the reference to the center of that Box?
So that the LocalFrame is also displayed in the center of the box.

Prashant Kande
Posts: 121
Joined: Mon Apr 04, 2016 4:55 am

Re: Change the reference point of an entity.

Post by Prashant Kande »

Good question, Juergen.

This is demonstrated in Transform sample.

Because surface of the object is defined relative to the local frame, you need to translate geometry relative to the local frame using IGeometricObject_DG.Translate(). After that, you will have local frame in the center of the object.

On the screen the surface will appear shifted, but the local frame remains same. You can move the whole thing back if you need to by using the normal IEntity_DG > GetLocation() > IFrame_DG > IFrame_DG.Translate().

Post Reply