protected override bool WorldDraw(WorldDraw draw) { WorldGeometry geo = draw.Geometry; if (geo != null) { if (jigUpdate) { stair = MyFunctions.CreateStair3D(steps, riser, tread, landing, width, slope); } switch (jigStatus) { case 0: geo.PushModelTransform(matDisplacement); geo.Draw(stair); geo.PopModelTransform(); break; case 1: geo.PushModelTransform(matDisplacement.PreMultiplyBy(matRotation)); geo.Draw(stair); geo.PopModelTransform(); break;; default: return(false); } } return(true); }
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) { WorldGeometry wGeo = draw.Geometry; if (wGeo != null) { wGeo.PushModelTransform(UCS); wGeo.Polygon(corners); wGeo.PopModelTransform(); } return(true); }
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) { mleader.EndPoint = mdragPT; Vector3d UserXaxis = db.Ucsxdir; Vector3d WXaxis = new Vector3d(1, 0, 0); Vector3d Zaxis = new Vector3d(0, 0, 1); double Rangle = UserXaxis.GetAngleTo(WXaxis); if (UserXaxis.Y < 0) { Zaxis = Zaxis.Negate(); //1.03版修改,修正角度旋转正负问题 } Matrix3d Rmat = Matrix3d.Rotation(Rangle, Zaxis, mdragPT); //旋转矩阵 if (mdragPT.TransformBy(UCS.Inverse()).X >= mbasePT.TransformBy(UCS.Inverse()).X) { Matrix3d mat = Matrix3d.Displacement(mbasePT.GetVectorTo(mdragPT)).PreMultiplyBy(Rmat); //旋转矩阵左乘位移矩阵 WorldGeometry geo = draw.Geometry; if (geo != null) { geo.Draw(mleader); geo.PushModelTransform(mat); foreach (Entity ent in mEntities) { geo.Draw(ent); } geo.PopModelTransform(); } } else { Line L = (Line)mEntitiesL[0]; Vector3d Vt = new Vector3d(L.Length, 0, 0); Matrix3d mat = Matrix3d.Displacement(mbasePT.GetVectorTo(mdragPT) - Vt).PreMultiplyBy(Rmat);//旋转矩阵左乘位移矩阵 WorldGeometry geo = draw.Geometry; if (geo != null) { geo.Draw(mleader); geo.PushModelTransform(mat); foreach (Entity ent in mEntitiesL) { geo.Draw(ent); } geo.PopModelTransform(); } } return(true); }
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) { Matrix3d mat3d = Matrix3d.Displacement(pnt3dRes - pnt3dBase); WorldGeometry wGeo = draw.Geometry; if (wGeo != null) { wGeo.PushModelTransform(mat3d); foreach (Entity ent in entities) { wGeo.Draw(ent); } wGeo.PopModelTransform(); } return(true); }
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) { Matrix3d mat = Matrix3d.Displacement(this.startPoint.GetVectorTo(this.insertPoint)); mat = currentUCS.PreMultiplyBy(mat); WorldGeometry geo = draw.Geometry; if (geo != null) { geo.PushModelTransform(mat); foreach (var ent in this.entities) { geo.Draw(ent); } geo.PopModelTransform(); } return(true); }
protected override bool WorldDraw(WorldDraw draw) { try { WorldGeometry geometry = draw.Geometry; if (geometry != null) { geometry.PushModelTransform(transforms); foreach (Entity entity in entityList) { geometry.Draw(entity); } } return(true); } catch (Exception ex) { ProxyCAD.Editor.WriteMessage(ex.Message); return(false); } }
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw) { Vector3d UserXaxis = db.Ucsxdir; Vector3d WXaxis = new Vector3d(1, 0, 0); Vector3d Zaxis = new Vector3d(0, 0, 1); double Rangle = UserXaxis.GetAngleTo(WXaxis); Matrix3d Rmat = Matrix3d.Rotation(Rangle, Zaxis, mdragPT); Vector3d VT = new Vector3d(1, 1, 1); //插入点转换向量 if (mdragPT.TransformBy(UCS.Inverse()).X >= mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y >= mbasePT.TransformBy(UCS.Inverse()).Y) { VT = new Vector3d(0, 0, 0); } if (mdragPT.TransformBy(UCS.Inverse()).X < mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y >= mbasePT.TransformBy(UCS.Inverse()).Y) { VT = new Vector3d(-mtableob.Width, 0, 0); } if (mdragPT.TransformBy(UCS.Inverse()).X < mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y < mbasePT.TransformBy(UCS.Inverse()).Y) { VT = new Vector3d(-mtableob.Width, -mtableob.Height, 0); } if (mdragPT.TransformBy(UCS.Inverse()).X >= mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y < mbasePT.TransformBy(UCS.Inverse()).Y) { VT = new Vector3d(0, -mtableob.Height, 0); } Matrix3d mat = Matrix3d.Displacement(mbasePT.GetVectorTo(mdragPT) + VT); WorldGeometry geo = draw.Geometry; if (geo != null) { geo.Draw(mleader); geo.PushModelTransform(mat.PreMultiplyBy(Rmat)); geo.Draw(mtableob); geo.PopModelTransform(); } return(true); }
public override bool WorldDraw(Drawable drawable, WorldDraw wd) { if (wd.RegenAbort || wd.IsDragging) { return(base.WorldDraw(drawable, wd)); } RebarPos pos = drawable as RebarPos; if (pos == null) { return(base.WorldDraw(drawable, wd)); } PosShape shape = PosShape.GetPosShape(pos.Shape); Extents3d?shapeExt = shape.Bounds; if (!shapeExt.HasValue) { return(base.WorldDraw(drawable, wd)); } Extents3d ext = shapeExt.Value; WorldGeometry g = wd.Geometry; SubEntityTraits s = wd.SubEntityTraits; TextStyle style = new TextStyle(); // Get geometry Point3d pt = pos.BasePoint; Vector3d dir = pos.DirectionVector; Vector3d up = pos.UpVector; Vector3d norm = pos.NormalVector; double w = pos.Width / dir.Length; double h = pos.Height / dir.Length; // Draw bound dimension lines foreach (RebarPos.BoundDimension dim in pos.GetBoundDimensions()) { Line line = new Line(dim.TextPosition, pos.BasePoint); g.Draw(line); } // Draw shape double xmin = ext.MinPoint.X, ymin = ext.MinPoint.Y, xmax = ext.MaxPoint.X, ymax = ext.MaxPoint.Y; // Scale double scale = 0.025; // Client offsets double xoff = (w - scale * (xmax - xmin)) / 2.0; double yoff = 2.0 * h;//(h - scale * (ymax - ymin)) / 2.0; // Transform Matrix3d trans = Matrix3d.AlignCoordinateSystem(new Point3d(xmin, ymin, 0), Vector3d.XAxis / scale, Vector3d.YAxis / scale, Vector3d.ZAxis / scale, pt + dir * xoff + up * yoff, dir, up, norm); g.PushModelTransform(trans); // Draw shapes shape.SetShapeTexts(pos.A, pos.B, pos.C, pos.D, pos.E, pos.F); g.Draw(shape); shape.ClearShapeTexts(); // Reset transform g.PopModelTransform(); return(base.WorldDraw(drawable, wd)); }