In AddEntities example there is a code, that shows how to insert a block. But it uses only attributes.
In real draws more common situation is, when there is a set of line/polylines or other entities in a block. How to set scale and rotation for them, and separately from attributes?
I want to do several insertions of a icon in a draw. Scale is the same for them, rotations are variate, subscriptions are look alike.
Thanks.
example for adding inserts
Moderators: SDS, support, admin
Re: example for adding inserts
Hello Pavel,
Scale and rotation can be easily set for a block reference (TsgDXFInsert) through Scale and Angle properties, respectively. To apply scaling/rotation to a particular entity in the block, you will need to multiply each point of the entity by coordinate transformation matrix using an FPointXMat function (sgFunction.pas):
To get a scaling matrix by a given scale value, you may use an FMatByScale function (sgFunction.pas):
To get a rotation matrix by a given angle, you may use an FMatByAngle function (sgFunction.pas):
Mikhail
Scale and rotation can be easily set for a block reference (TsgDXFInsert) through Scale and Angle properties, respectively. To apply scaling/rotation to a particular entity in the block, you will need to multiply each point of the entity by coordinate transformation matrix using an FPointXMat function (sgFunction.pas):
Code: Select all
function FPointXMat(const APoint: TFPoint; const AMatrix: TFMatrix): TFPoint;
Code: Select all
function FMatByScale(const Scale: Double): TFMatrix;
Code: Select all
function FMatByAngle(const Angle: Double): TFMatrix;
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support