algorithmic modeling for Rhino
I am trying to make a Component which holds a grasshopper definition... but i have Problems with Saving it to 3dm . It becomes a Brep again... The guid Attributes does not Help by the way...
[Guid("688936e4-f804-4c96-91fb-dd6bab3d2f90")]
public class ExtendBrep : Rhino.DocObjects.Custom.CustomBrepObject
{
public ExtendBrep(Rhino.Geometry.Brep brep) : base(brep) { this.Attributes = new ObjectAttributes(); }
public ExtendBrep() : base() { }
protected override void OnPicked(Input.Custom.PickContext context, IEnumerable<ObjRef> pickedItems)
{
try
{
Random random = new Random();
this.Attributes.ColorSource = ObjectColorSource.ColorFromObject;
this.Attributes.ObjectColor = System.Drawing.Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
}
catch (Exception e) { System.Windows.Forms.MessageBox.Show("OnPicked: " + e.Message); }
base.OnPicked(context, pickedItems);
}
protected override void OnDuplicate(Rhino.DocObjects.RhinoObject source)
{
try
{
Random random = new Random();
this.Attributes.ColorSource = ObjectColorSource.ColorFromObject;
this.Attributes.ObjectColor = System.Drawing.Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
}
catch (Exception e) { System.Windows.Forms.MessageBox.Show("OnDuplicate: " + e.Message); }
base.OnDuplicate(source);
}
}
thanks for Help
Tags:
Hi Michael,
I don't get it. How does a GH_Document become a Brep?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
maybe it is liitle bit offtopic .... i can not register to plugin news group... company settings sorry... so what i want to do is to have custom objects in the document [RhinoDoc] which behave different to a normal Brep or Curve
I use a inheited class from Rhino.DocObjects.Custom.CustomBrepObject but i can not save it to a 3dm file. Maybe where is a special mechanic like attributes existing [Serialize(Guid)]...
With his feature it would be possible to have Custom Objects in the rhinoscreen which a holding an grasshopper xml for example... and could behave totaly different to normal Breps... My problem is not to make such objects but to save whem in a 3dm file...
maybe where is a example existing how to do this, else i have to build a custom format which is not 3dm...
Ah, I didn't even know about the DocObjects.Custom namespace, it has passed me by. I can't answer your question, you may have to contact Steve Baer directly if you're not allowed to ask questions through the regular channels.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
if this works you can have family objects like revit with a grasshopper definition.... this would rock. I will write Steve Bear a mail.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by