.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Point Collection from 3dsolid

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
wein3967
1324 Views, 7 Replies

Get Point Collection from 3dsolid

I know this must be an easy answer, but for the life I me I can't find the method that returns a point collection for a given 3dsoild.  I have to think that a property exists that contains all the points for a solid (the ones shown when you select a 3dsolid).  I appreciate the help.  Thanks!

7 REPLIES 7
Message 2 of 8

Solution: http://through-the-interface.typepad.com/through_the_interface/2008/09/traversing-a-3d.html

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 8
wein3967
in reply to: wein3967

Thank you for the link.  I guess it wasn't quite as easy as I would have thought.  I figured there would just be a property for 3dsolids that contained all the points.  Never the less, I can probably get that code to work.  Thanks again.

Message 4 of 8
_gile
in reply to: wein3967

Hi,

 

If you only need the solid vertices, you don't need to run through the whole brep tree.

 

Here's a little sample.

 

        public Point3dCollection GetSolidVertices(ObjectId id)
        {
            Database db = HostApplicationServices.WorkingDatabase;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                Solid3d sol = tr.GetObject(id, OpenMode.ForRead) as Solid3d;
                if (sol == null) return null;
                try
                {
                    Point3dCollection pts = new Point3dCollection();
                    using (Brep brp = new Brep(sol))
                    {
                        foreach (var vtx in brp.Vertices)
                        {
                            pts.Add(vtx.Point);
                        }
                        return pts;
                    }
                }
                catch { return null; }
            }
        }

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 8
wein3967
in reply to: _gile

Thanks _guile, that was more along the lines of what I was looking for.  Excellent.

Message 6 of 8
Hugh_Compton
in reply to: wein3967

 

Sorry for my ignorance but when I convert this to VB.Net I get an unknown type for 'var'...?

 

Message 7 of 8
_gile
in reply to: Hugh_Compton

Hi,

 

In C#, var keyword stands for 'implicit type', the (strongly typed) variable type is determined by the compiler at edition time.

In this case, the infered type is: Autodesk.AutoCAD.BoundaryRepresentation.Vertex



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 8 of 8
Hugh_Compton
in reply to: _gile

Thanks Giles!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost