21 Posts
0 Kudos
Registered: ‎08-05-2012
Post 1 of 8

SelectionSet objects

440 Views, 7 Replies
08-08-2012 11:08 AM

I'd like understand better how to deal with SelectionObj in SelectionSets..


How do i classify SelectionObj(s) as specific entities , like line2d,,   so I can utilize them better with line2d methods..


would be better if i could prompt for lines and only allow lines for selection? is there such a function or do i program a IF that checks selectionSet and message user if some objects was not a linetype


my concept understanding is to:

  for each selectionOBJ in selectionSET          

    trycast  selectionObj.getobjectType,  line2d



does that make sense?

i dont know how id put that in vb code.. if even possible.  please point me in a direction.    'forgive my noobness



Distinguished Contributor
404 Posts
3 Kudos
Registered: ‎11-11-2002
Post 2 of 8

Re: SelectionSet objects

08-08-2012 11:34 AM in reply to: theEntity

You want to learn to use selection set filters.




There is a AutoCAD .NET Developer’s Guide available as a Pdf which has many samples of using selection set filters.


I could not find a link for the Pdf, maybe someone else can provide you a link.



*Expert Elite*
2,140 Posts
253 Kudos
Registered: ‎04-29-2006
Post 3 of 8

Re : SelectionSet objects

08-08-2012 01:30 PM in reply to: theEntity



It looks like you're confusing Autodesk.AutoCAD.Gemometry.Line2d (which is a geometric object without graphic representation and which can't be select) with Autodaek.AutoCAD.DatabaseServices.Line (which is the graphic object you can select).

See this thread:


Gilles Chanteau
21 Posts
0 Kudos
Registered: ‎08-05-2012
Post 4 of 8

Re : SelectionSet objects

08-09-2012 10:41 AM in reply to: _gile

ok thx fxcastil i looked at selection filters it will help me.


@ _gile

I see what u mean with difference in databaseservice vs. geometery objects


my goal: is to get a selection of lines. then access each individual lines X & Y (@endPoint) coordinates and change them individually.

I prompt for a Start point (which will not change x & y) ,, then i need to name this line and proceding lines in order,, like 1-2  ,2-3, 3-4 ect.   These lines will almost close back onto the Start point.

from here, I calculate the distance in x & y needed for closure and adjust all the lines individually (but in proportion) so that they close a polygon.

THE MAIN idea is i need to read Start and End points on the selected lines INdividually and change with some calculated variables.

the calculations i can code myself. im comfortable enough with vb.net.. i just need to access some values. 


IN Geomatics Engineering we call this  "Compass Rule Adjustment"

I choose this as my starting project to learn Autocad.net programming.

Later i will do more complex projects for least square adjustments.


my problem i have a selectionSET of SelectionObj(s) .. (which i filter) so i know they are definitly lines

How do i classify them as such so i can access the X&Y properties to change them..

or How would YOU do this project?

not show me excatly, just some direction would help me learn myself.


I do have developer's Guide but it can be sometimes obscure for a new learner.


thanks in advance




my idea is to check each selected line IF Start coodinates = PrompPointResult.x and PrompPointResult.y THEN

that line.id = "1"

check IF line.id("1").x and line.id("1").y = check each selected line for match THEN label that match line.id = "2"


but how to syntax


21 Posts
0 Kudos
Registered: ‎08-05-2012
Post 5 of 8

Re : SelectionSet objects

08-09-2012 11:17 AM in reply to: theEntity

should i first give all the selectionobjects aka.lines in my selectionset a typedvalue line "LINE"?

*Expert Elite*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 6 of 8

Re : SelectionSet objects

08-09-2012 01:15 PM in reply to: theEntity

You'll be more likely to show us your code you've started with



21 Posts
0 Kudos
Registered: ‎08-05-2012
Post 7 of 8

Re : SelectionSet objects

08-09-2012 03:44 PM in reply to: Hallex

YES  i solved my own problem,  sry to waste your time guys


For Each obj As SelectedObject In MySelectedSet
Dim ent As Entity = trsAct.GetObject(obj.ObjectId, OpenMode.ForRead)
Dim line As Line = ent





with the line variable i have access to X Y coordinates of lines start point and more methods related to lines specifically


from here things get easier. 

now i just need to figure out how to give each line its own name.. it will be much more convienent than as refering to Ojectids.. blockName? no readonly


what is line.ownerId?

21 Posts
0 Kudos
Registered: ‎08-05-2012
Post 8 of 8

Re : SelectionSet objects

08-09-2012 04:21 PM in reply to: theEntity

I think this is where dictionary comes to play.  because there is no property to name my line i can perhaps attach a xrecord to the line's extentionDictionary   and if i need that line , i can call it refering to the saved xrec.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!