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

Region and Mesh Points

4 REPLIES 4
Reply
Message 1 of 5
artisteroi
1160 Views, 4 Replies

Region and Mesh Points

Does anyone know how to to get the points of a region using c#. ?

 

We have irregular shaped regions (and meshes) that we are trying to map for duplication. I've seen the code that gets the mass properties but cant figure out how to expand that down to the individual points/coordinates that make up the border of the region/meshes. Which is what I am looking for. Any help would be great.

4 REPLIES 4
Message 2 of 5
StephenPreston
in reply to: artisteroi

You should be able to do this with the BRep API - see the Autodesk.AutoCAD.BoundaryRepresentation namespace.

 

SubDMesh.GetObjectMesh may be another option, but I've not tested that it supports Regions.

 

Cheers,

 

Stephen Preston

Autodesk Developer Network

Cheers,

Stephen Preston
Autodesk Developer Network
Message 3 of 5
artisteroi
in reply to: StephenPreston

any cahnce you have an example of this? I am getting no where with it, so I must be doing it wrong.

Message 4 of 5

Generating a mesh for a 3D solid using AutoCAD’s Brep API from .NET
AutoCAD : Brep .NET

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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 5 of 5

this should be enough to get you started ...

 

TypedValue[] acTypValAr = new TypedValue[1];
acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "REGION"), 0);
SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
PromptSelectionResult acSSPrompt;
acSSPrompt = ed.GetSelection(acSelFtr);
if (acSSPrompt.Status != PromptStatus.OK)
    return;
SelectionSet acSSet = acSSPrompt.Value;
foreach (SelectedObject acSSObj in acSSet)
{
    if (acSSObj != null)
    {
        Region R1 = null;
        using (Transaction trans = db.TransactionManager.StartTransaction())
        {
            R1 = (Region)trans.GetObject(acSSObj.ObjectId, OpenMode.ForRead);
            trans.Commit();
        }
        string s1 = "";
        using (Brep brp = new Brep(R1))
        {
            foreach (Edge e1 in brp.Edges)
            {
                foreach(BoundaryLoop bl1 in e1.Loops)
                {
                    foreach(Autodesk.AutoCAD.BoundaryRepresentation.Vertex v1 in bl1.Vertices)
                    {
                        s1 = s1 + v1.Point.X.ToString("F3") + " , " + v1.Point.Y.ToString("F3") + "\r\n";
                    }
                    break;
                }
                break;
            }
        }
        WINFORM.MessageBox.Show(s1);
        return;
    }
}

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