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.
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
any cahnce you have an example of this? I am getting no where with it, so I must be doing it wrong.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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
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; } }