| | | Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für Autodesk Produkte |
Autor
|
Thema: unter .net Objekte zu einer Gruppe zusammenfassen (925 mal gelesen)
|
Dirk.B Mitglied Tischler / Leiter Arbeitsvorbereitung
Beiträge: 534 Registriert: 25.11.2003 AutoCAD 2019/2020 CAD+T 2020 HP ZBook 15 G4, 64-bit, WIN 10 Pro
|
erstellt am: 27. Feb. 2013 11:07 <-- editieren / zitieren --> Unities abgeben:
Hallo zuasmmen! Mittels .net erstelle ich Objekte wie Kreise, Polylinien etc. und füge die meiner Zeichnung (Modelbereich) zu. Diese sind dann ja alle einzelne Objekte. Kann man diese auch mit .net als Gruppe zusmmanefassen, wie der Befehl aus AutoCAD _group hergibt. Ich benötige diese nicht als Block, aber als Gruppe wäre das nicht schlecht. Könnte mir jemand, wenn das möglich ist, dabei auf die Sprünge helfen? Vielen Dank im voraus. ------------------ Gruß Dirk Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
Brischke Moderator CAD on demand GmbH
Beiträge: 4171 Registriert: 17.05.2001 AutoCAD 20XX, defun-tools
|
erstellt am: 27. Feb. 2013 11:35 <-- editieren / zitieren --> Unities abgeben: Nur für Dirk.B
Hallo Dirk, die Gruppen werden als Dictionary gefüht. Nachfolgend ein Code (aus den Untiefen des Internets, nicht von mir) zum Auslesen der Gruppe. Ich denke, aus diesem kann man Rückschlüsse ziehen, wie man Gruppen erzeugen kann. Code:
' Define command 'getGroupIds' - by Fenton Webb, DevTech, Autodesk 12/09/2006 <CommandMethod("getGroupIds")> _ Public Sub getGroupIds() ' input the group name we want to list Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim groupName As PromptResult = ed.GetString("Enter Group name to list : ") ' get the working database Dim db As Database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase ' start a transaction Dim trans As Transaction = db.TransactionManager.StartTransaction() ' now try the read Try ' get the named objects dictionary Dim nod As DBDictionary = trans.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) ' now get the ACAD_GROUP dictionary entry, this contains all of the Groups defined in the drawing Dim acadGroup As DBDictionary = trans.GetObject(nod("ACAD_GROUP"), OpenMode.ForRead) ' next, find the group name that was entered above Dim groupRequired As Group = trans.GetObject(acadGroup(groupName.StringResult), OpenMode.ForRead) ' we now have the group required, lets find out what's inside Dim entityIds As ObjectId() = groupRequired.GetAllEntityIds() Dim id As ObjectId For Each id In entityIds ' open the entity for read Dim ent As Entity = trans.GetObject(id, OpenMode.ForRead) ' create the highlight path Dim path As FullSubentityPath = New FullSubentityPath(New ObjectId(0) {id}, New SubentityId(SubentityType.Null, 0)) ' now highlight it ent.Highlight(path, True) Next trans.Commit() Catch ex As Exception MsgBox(ex.Message) trans.Dispose() Finally End Try End Sub
Grüße! Holger ------------------ Holger Brischke FREIE SCHULUNGSPLÄTZE -- C#.NET-Schulung im Mai 2013 Bei Interesse bitte melden! CAD on demand GmbH Individuelle Lösungen von Heute auf Morgen.
defun-tools Das Download-Portal für AutoCAD-Zusatzprogramme!
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
| Anzeige.:
Anzeige: (Infos zum Werbeplatz >>)
|