Grasshopper

algorithmic modeling for Rhino

Hi,

How can I get a plane or vector3D from the centre of planar Curve in a C#?

Thanks,

Petras.

Views: 688

Replies to This Discussion

Define 'centre'.

Curves have the TryGetPlane method which allows you to find the plane within which a curve lies. Once you have the plane you can access the ZAxis to get the normal. But the exact location of the plane may not be anywhere near whatever the 'centre' may be.

Thank you for a reply.

Could you tell me how to use TryeGetPlane correctly? I get an error:

No overload for method 'TryGetPlane' takes 0 arguments  

C#:

               Curve[] edges = glassSrf.GetWireframe(-1); // Edges
                Curve joinedEdges = Curve.JoinCurves(edges)[0]; //Joined Edges

                Plane planes = joinedEdges.TryGetPlane();

Plane pln;
joinedEdges.TryGetPlane(out pln);

Thanks you.

Thanks Daniel.

One more question.

How to add trasnparent icon to the component?

C#:

        protected override System.Drawing.Bitmap Icon
        {
            get
            {
             
               // return Properties.Resources.offsetIcon.MakeTransparent(System.Drawing.Color.White); // This does not work.

              return Properties.Resources.offsetIcon;   // This works
           }
        }

Also tried:

                Properties.Resources.offsetIcon.MakeTransparent(System.Drawing.Color.White);
                return Properties.Resources.offsetIcon;

No error, but still no transparency.

Just add a transparent bitmap (.png format).

protected override System.Drawing.Bitmap Icon

{
            get
            {

                 return Properties.Resources.YourBitmap

           }
}

or you can also create it (the bitmap) from code.

Works. Thank you.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service