实现思路:
1、实例化图形类,并应用TransformBy实现变换。
poly.TransformBy(Matrix3.RotationZ(30*MathHelper.DegToRad), Vector3.Zero);
2、将图形插入block,利用Insert对象实现变换。
Block block = new Block("MyBlock");
block.Entities.Add(poly);
Insert insert = new Insert(block);
insert.Position = new Vector3(12,22,4);
insert.Scale = new Vector3(1.25,0.75,1);
insert.Rotation = 30;
insert.Normal = new Vector3(1,1,1);
3、完整范例
LwPolyline poly = new LwPolyline(new[] {p1,p2,p3,p4,p5,p6,p7,p8}, true);
poly.Normal = Vector3.UnitX;
poly.TransformBy(Matrix3.RotationZ(30*MathHelper.DegToRad), Vector3.Zero);//图形本身的变换
Block block = new Block("MyBlock");
block.Entities.Add(poly);
//插入变换
Insert insert = new Insert(block);
insert.Position = new Vector3(12,22,4);//位置
insert.Scale = new Vector3(1.25,0.75,1);//三轴缩放
insert.Scale = new Vector3(1,2,3);
insert.Rotation = 30;//旋转
insert.Normal = new Vector3(1,1,1);
使用教程:
5、图形变换