AutoCAD .NET :: How To Select Object Via ObjectID Or Handle
Jul 29, 2011
Question,
I have a list of blocks in a datagrid. When i double click a certain record it gets the objectid or handle.
Now i know how too highlight the object. But i don't want to highlight the entity but select it so i can change it's property's in the property pallet.
In the first screen shot you see the code i have. wicht highligts the record but the propperty pallet display no object selected.
But i want it to work like the next picture.
So the question is. When i know an entity's objectid or handle how do i select that entity programticly.
I need to use the Handle of the cloned object during a DeepClone override but AutoCAD shuts down when I try to use it.
This is the best I can think of but it still boots me out when I try.
Public Overrides Function DeepClone(ByVal dbObject As DBObject, ByVal ownerObject As DBObject, ByVal idMap As IdMapping, ByVal isPrimary As Boolean) As DBObject Try Return MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary) Catch Finally CompileCloneObjects(dbObject.Handle.ToString, MyBase.DeepClone(dbObject, ownerObject, idMap, isPrimary).Handle.ToString) End Try End Function
If I have a list of handles for Autocad Entities, how would I go about selecting these entities on screen so that the user could add to this selection or remove objects from the selection? I could go with object ids as well if needed.
I have been searching and searching and coming up empty handed or at least coming up with information that doesn't seem to do what I want.
I wrote code for an application that stores links to lines and blocks in dictionaries using handles. The routines work well and I can manipulate the data marvelously, but if one of the lines or blocks get erased the whole danged opera falls apart. I knew this when I wrote the routines and have always been careful about using the ERASE command, as a matter of fact, I considered disabling it.
I am trying to make the package more robust. I have been experimenting with attaching a reactor (:vlr-erased) to the objects which fires when the object is erased. Unfortunately it fires before I can retrieve the handle of the object so that I can remove the references from the dictionaries. The only thing that I can retrieve once ERASE fires is the ObjectID. I can't seem to find a Visual Lisp routine to convert this value to a handle, does one exist? Is there an ObjectID collection that has any references in it?
I've got 1800 attributes that need to be numbered from 1 to 1800 from left to right.
I got a Lisp that can do that but the only thing is when I select it with selection window, he wil sort all atributes on their unique handle code. So I have the first 40 attributes going from left to right with groups of numbers at the wrong place like 1-10, 31-40, 21-30, 11-20 instead of 1-40.
This is because when you copy an attribute he wil place a new unique handle coded attribute and the copy contains the previous handle code.
But if I select them one by one from left to right and run my lisp it just works fine cause it seems it doesnt look at the handle code to place the numbers in that order.
So is there a way that I can select multiple attributes, like I'm selecting them one by one from left to right, so I can bypass this attribute handle code?
Messing around with MAP in Civil3d 2011, creating object data for sanitary sewer manholes, how do you handle object data for inverts since there could be multiple depths and directions. Whats the best way to set it up? And what kind of addtional info should there be. And when I connect to a shp file, how do you label with multiple lines, I seem to only be able to select 1 feature to label. When zoomed out would like to view structure name and when zoomed in view name, rim elevation, invert elevations.
Civil3D 2013 Windows 7, 64 bit Intel i7 2600 @ 3.40Ghz 16 GB RAM Nvidia Quadro 600
master im new in autocad 2014....i have a problem now when i select line or object it highlight or make a broken line....but when i select the other object or line my previous selected back to normal..i mean i can select only one line if i use single selecting....how to select all object or line with single select continuously, except using hold left click...
I'm missing the Center Pin, Ellipse, Feather Handle and the Focus Ring when I select the Iris Blur filter. The pointer is a tack symbol and am unable to change that.
When I select an object and pan to make another selection the first object "deselects". The object(s) will stay selected until I pan and as soon as I start to pan the grips go away and the object(s) is deselected.
have to select an object under an artistic media brush object. i try hold down alt key when select the object under the artistic media object but it select the second object
I can store some ObjectId from my drawing to text file. After that how we can get back ObjectId from string read from that text file. Or have a diferrent way to store the ObjectID.
I have a drawing with a Polyline filled with Hatch. Also I have that Polyline ObjectId. So using this ployline ObjectId I want to erase the Hatch inside polyline. How I can erase the Hatch.
I create a polyline ,and then add it's objectId to a ObjectIdCollection defined by me.After the polyline is created,I would like to obtain it's second and sixth vertexes via this polyline's objectId.
I have stored within an external database a handle of an entity within a drawing. If I have that drawing open and I retrieve that handle and then get the ObjectID from that Handle how do I convert that to a BlockReference so that I can then get position and attrribute values. I can get the position and attributes if I can just get the blockreference from the Object ID.
I am using the following code to get the ObjectID from the Handle:
Public Function ObjectIdFromHandle(db As Database, strHandle As String) As ObjectId Dim nHandle As Int32 = Int32.Parse(strHandle, Globalization.NumberStyles.AllowHexSpecifier) Dim handle As New Handle(nHandle) Dim ids(0) As ObjectId Try ids(0) = db.GetObjectId(False, handle, 0) Catch ex As Exception MsgBox(ex.Message.ToString, MsgBoxStyle.Exclamation, "Error in ObjectIDfromHandle") End Try Return ids(0) 'Return db.GetObjectId(False, handle, 0) End Function
I then want to use this ObjectID to get the BlockReference.
I need to make my application compatible with 2008 and have one error saying that ObjectClass is not a member of SubEntId (As ObjectID) in my InsertBlock routine.
Public Sub InsertBlock(ByVal blockname As String, ByVal trans As Transaction) Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database ' Test if block exists in the block table Dim bt As BlockTable =
We have a schedule tag for space objects created on our tool palette. When you use the Multiple option, you cannot do a window selection unless only spaces are visiable. If other object types are in the selection set, the program seems to get hung up... no error is produced... it just seems to spin relentlessly. We have to Cnt+Alt+Delete to get out of it. You cannot preselect the spaces and use 'P' for previous selection set, since the last selection set was the first one you selected to place the first shedule tag.
I thought I could create a tool to return the selection set to the select object prompt with the simple line of code, like this - this should work but does not:
(ssget "X" (list (cons 0 "AEC_SPACE")))
it returns the spaces to the prompt, but for some reason they get filtered out.Below is the command line snippet that shows multiple attempts...
Command: _AecScheduleTag Select object to tag: Specify location of tag <Centered>: Select object to tag [Multiple]: m Select objects to tag: (setq ss (ssget "X" (list (cons 0 "AEC_SPACE")))) <Selection set: 12dc> 7 found 7 were filtered out Select objects to tag: !ss <Selection set: 12dc> 7 found 7 were filtered out, 0 total Select objects to tag: !ss <Selection set: 12dc> 7 found 7 were filtered out, 0 total
I'm creating a VB.Net routine which will run the REVCLOUD command. In my application I prompt the user to select a single polyline using:
EntRslt = acDoc.Editor.GetEntity(EntOpts)
Then later I run the REVCLOUD command using:
acDoc.SendStringToExecute("_revcloud Object Poly No ", False, False, True)
Where Poly is the polyline I selected earlier. Of course, the line above doesn't work since "Poly" is interpreted as a string. But I would like to figure out how to pass my VB.Net selected Polyline into the REVCLOUD command.
How I might do this? The REVCLOUD command will not accept the "Previous" selection set so setting the Implied Selectoin does not work. If my Polyline was the Last object in the database I could use the "Last" option, but it isn't.
I have a data grid view with all alignments included in the drawing file. If I choose an alignment in data grid view, I have Id of that alignment.
I have a button, and I would like that if i press that button then selects that alignment in the drawing(graphic). I would like that there was only one object selected, and if there are more selected objects before,then un-selected them.
When I select an object to move I am unable to snap to the grips of the object or any other object close or any intersections. I have double and triple checked my osnap settings. Also, If I select a circle to move I am unable to select the center of the circle through additional osnap settings. One last issue, If I select an object and do a copy with base point command, I am unable to select a definitive base point. No grips or intersections show up.
My co-workers are able to do these functions but I am not.
PROBLEM: When I go to select the objects as as a SINGLE OBJECT, each object within the group is selectable -- as if they were not grouped.Shouldn't it be that when I select ANY of the objects within the group ALL OBJECTS in the group get selected, and not just each object?
We have a perenial problem with our old GIS software where files corrupt and drawing objects are lost.
There are few export options available, but export to shape is one of them. This means that I can export a damaged file and then import it into CAD with the layers intact and the tagged numbers (similar to object data or a block attribute in CAD) imported as object data. In order to make a new uncorrupted version for the GIS program.
Is there a way to select objects by object data?
If a file is corrupted, the only real way to repair it at the moment is to go back to the original cad drawing and reimport and then retag every single tagged attribute on what can be thousands of drawing objects, and by then we may no longer have the handdrawn data to even do that.
The next workaround is if I creat new dwgs from the cad drawing, Each one containing the objects with the same object data, and each saved with a file name that matches that object data, and then reimport into the GIS. (it can use the filename as a tag). This creates a new GIS file with the surviving information that should not lose any more data and we may be able to patch the 'holes' afterwards.
The problem is selecting all the polylines in the cad drawing that have that same tagged number in the object data. Select similar just goes on object type and layer. This would be easier if I could select by object data and get everything with the same tag in one go.
A way to batch create the new dwgs from that selected data would be nice too.
Im trying out the "Demo"version and now find some anomaly.
If i use in ACAD2007: With "PSELECT" and then "P" or "L" i could select the last marked Object/Selectionset. I had just to select the Object with the mouse. Now in ACAD2010, with this routine i can only select objects which i have selected in a command (before or within).
For example: Draw a few circles and lines. Then copy 3 of them. ESC. And select another few. ESC and then use PSELECT P and it marks the three which i selected to copy and not these i've selected with mouse!
The same in Lisp with: (entget(entlast)) . You aren't able to select those object which where only marked by mouse.I know; mostly you use a command with some objects and then use another with the same objects, and it works. But when you klick ESC or even in Script or Lisp you got problems, and its not very "proper" at all. Is this the new handling with the selection set: feature odr big?