How to implement it like below ?
you can set the linetype in the object attributes. Below a python example, it should work very similar using RhinoCommon:
import Rhino
import scriptcontext
def DoSomething():
plane = Rhino.Geometry.Plane.WorldXY
circle = Rhino.Geometry.Circle(plane, 10.0)
index = scriptcontext.doc.Linetypes.Find("DashDot", True)
if index < 0: return None
source = Rhino.DocObjects.ObjectLinetypeSource.LinetypeFromObject
attr = Rhino.DocObjects.ObjectAttributes()
attr.LinetypeSource = source
attr.LinetypeIndex = index
scriptcontext.doc.Objects.AddCircle(circle, attr)
scriptcontext.doc.Views.Redraw()
if __name__=="__main__":
DoSomething()
c.
Thank you for help.
This example is good for me.
My solution:
Rhino.Geometry.Point3d center = new Rhino.Geometry.Point3d( 0, 0, 0 );
const double radius = 10.0;
Rhino.Geometry.Circle c = new Rhino.Geometry.Circle( center, radius );
//
var attrib = new ObjectAttributes();
attrib.LinetypeIndex = RhinoDoc.ActiveDoc.Linetypes.Find("DashDot", true);
attrib.LinetypeSource = ObjectLinetypeSource.LinetypeFromObject;
if (Rhino.RhinoDoc.ActiveDoc.Objects.AddCircle(c, attrib) != Guid.Empty)
{
...
}