- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am just getting into programming a dll inside acad. Not sure this is the route to go since I have an data object that I need get and incorporate into my dll. Is there any way to get an object inside a dll from another outside program?
I am trying to create a routine that asks for a selection set of lbocks (probably filtered i guess) then serches for a specific attribute tag, which would be a number, then to adds the set of blocks with that attribute value.
I have gotten to the part where it ask the user to select some elements which I will filter out the blocks (of many differant block names) the I want to look at a specific attribute tag and add them, if it is valid. I have a sample which I am just beginning to debug. The tag name is: DEVICENUMBER, the value is any number. Could use some help from the experts. The following code does not work for getting a selection set I need.
Public Sub GetSelection()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim values() As TypedValue = {New TypedValue(DxfCode.Start, "BLOCK")}'this is where I am having the selection problem
Dim sfilter As New SelectionFilter(values) ' Create the filter using our values...
'Set the selection options
Dim SelOpts As New PromptSelectionOptions()
SelOpts.MessageForAdding = "Select elements:"
SelOpts.AllowDuplicates = True
'Make the selection:
Dim res As PromptSelectionResult = ed.GetSelection(SelOpts, sfilter)
If Not res.Status = PromptStatus.OK Then Return
Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value
Dim idarray As ObjectId() = SS.GetObjectIds()
Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
Dim myT As Transaction = tm.StartTransaction()
Try
Dim id As ObjectId
For Each id In idarray
Dim entity As Entity = tm.GetObject(id, OpenMode.ForRead, True)
ed.WriteMessage((ControlChars.Lf + "You selected: " + entity.GetType().FullName))
Next id
Finally
myT.Dispose()
End Try
End Sub
Solved! Go to Solution.