public void Set(DXFStructure dxf, CIRCLE item, float ScaleX = 1, float ScaleY = 1) { var goLayer = GoView.Content.GetLayer(item.C8); if (goLayer != null) { lr.material = goLayer.LayerMaterial; ZoomAdjust = goLayer.ZoomAdjust; } float R = (float)item.C40; Diameter = R * 2; //计算一个圆需要多少线条 int resolution = (int)item.C40 / OptimizingLevel; if (resolution > MaxResolution) resolution = MaxResolution; if (resolution < MinResolution) resolution = MinResolution; lr.SetVertexCount(resolution + 1); for (int i = 0; i < resolution; ++i) { lr.SetPosition(i, new Vector3((R * Mathf.Cos(2 * Mathf.PI / resolution * i) + (float)item.C10) * ScaleX, (R * Mathf.Sin(2 * Mathf.PI / resolution * i) + (float)item.C20) * ScaleY, 0)); } lr.SetPosition(resolution, new Vector3((R * Mathf.Cos(2 * Mathf.PI / resolution * 0) + (float)item.C10) * ScaleX, (R * Mathf.Sin(2 * Mathf.PI / resolution * 0) + (float)item.C20) * ScaleY, 0)); this.gameObject.isStatic = true; }
protected override Property ReadSonClass(Property prop) { if (prop.Code == 0 && prop.Value != "ENDBLK") { switch (prop.Value) { //case "C3DFACE": //case "C3DSOLID": //case "ACAD_PROXY_ENTITY": case "ARC": var arc = new ARC(DXFData, prop); ARCList.Add(arc); return(arc.ReadProperties()); //case "ATTDEF": //case "ATTRIB": //case "BODY": case "CIRCLE": var circle = new CIRCLE(DXFData, prop); CIRCLEList.Add(circle); return(circle.ReadProperties()); //case "DIMENSION": case "ELLIPSE": var ellipes = new ELLIPSE(DXFData, prop); ELLIPSEList.Add(ellipes); return(ellipes.ReadProperties()); //case "HATCH": //case "HELIX": //case "IMAGE": case "INSERT": var insert = new INSERT(DXFData, prop); INSERTList.Add(insert); return(insert.ReadProperties()); //case "LEADER": //case "LIGHT": case "LINE": var line = new LINE(DXFData, prop); LINEList.Add(line); return(line.ReadProperties()); case "LWPOLYLINE": var lwpolyline = new LWPOLYLINE(DXFData, prop); LWPOLYLINEList.Add(lwpolyline); return(lwpolyline.ReadProperties()); //case "MESH": //case "MLINE": //case "MLEADERSTYLE": //case "MLEADER": //case "MTEXT": //case "OLEFRAME": //case "OLE2FRAME": //case "POINT": //case "POLYLINE": //case "RAY": //case "REGION": //case "SECTION": //case "SEQEND": //case "SHAPE": //case "SOLID": //case "SPLINE": //case "SUN": //case "SURFACE": //case "TABLE": case "TEXT": var text = new TEXT(DXFData, prop); TEXTList.Add(text); return(text.ReadProperties()); //case "TOLERANCE": //case "TRACE": //case "UNDERLAY": //case "VERTEX": //case "VIEWPORT": //case "WIPEOUT": //case "XLINE": default: return(CreateSonClass(new ENTITIE(DXFData, prop))); } } else { return(base.ReadSonClass(prop)); } }
protected override Property ReadSonClass(Property prop) { if (prop.Code == 0 && prop.Value != "ENDSEC") { switch (prop.Value) { //case "C3DFACE": //case "C3DSOLID": //case "ACAD_PROXY_ENTITY": case "ARC": var arc = new ARC(DXFData, prop); ARCList.Add(arc); return arc.ReadProperties(); //case "ATTDEF": //case "ATTRIB": //case "BODY": case "CIRCLE": var circle = new CIRCLE(DXFData, prop); CIRCLEList.Add(circle); return circle.ReadProperties(); //case "DIMENSION": case "ELLIPSE": var ellipes = new ELLIPSE(DXFData, prop); ELLIPSEList.Add(ellipes); return ellipes.ReadProperties(); //case "HATCH": //case "HELIX": //case "IMAGE": case "INSERT": var insert = new INSERT(DXFData, prop); INSERTList.Add(insert); return insert.ReadProperties(); //case "LEADER": //case "LIGHT": case "LINE": var line = new LINE(DXFData, prop); LINEList.Add(line); return line.ReadProperties(); case "LWPOLYLINE": var lwpolyline = new LWPOLYLINE(DXFData, prop); LWPOLYLINEList.Add(lwpolyline); return lwpolyline.ReadProperties(); //case "MESH": //case "MLINE": //case "MLEADERSTYLE": //case "MLEADER": //case "MTEXT": //case "OLEFRAME": //case "OLE2FRAME": //case "POINT": //case "POLYLINE": //case "RAY": //case "REGION": //case "SECTION": //case "SEQEND": //case "SHAPE": //case "SOLID": //case "SPLINE": //case "SUN": //case "SURFACE": //case "TABLE": case "TEXT": var text = new TEXT(DXFData, prop); TEXTList.Add(text); return text.ReadProperties(); //case "TOLERANCE": //case "TRACE": //case "UNDERLAY": //case "VERTEX": //case "VIEWPORT": //case "WIPEOUT": //case "XLINE": default: return CreateSonClass(new ENTITIE(DXFData, prop)); } } else { return base.ReadSonClass(prop); } }