SelectionSet objects

SelectionSet objects

Anonymous
Not applicable
2,083 Views
7 Replies
Message 1 of 8

SelectionSet objects

Anonymous
Not applicable

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

 

 

0 Likes
2,084 Views
7 Replies
Replies (7)
Message 2 of 8

fxcastil
Advocate
Advocate

You want to learn to use selection set filters.

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html

 

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.

 

 

Message 3 of 8

_gile
Consultant
Consultant

Hi,

 

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:

http://forums.autodesk.com/t5/NET/Entity-vs-Entity2d/td-p/3564086



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 4 of 8

Anonymous
Not applicable

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

 

 

edit:

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

 

0 Likes
Message 5 of 8

Anonymous
Not applicable

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

0 Likes
Message 6 of 8

Hallex
Advisor
Advisor

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

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 7 of 8

Anonymous
Not applicable

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

 

next

 

now:

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?

0 Likes
Message 8 of 8

Anonymous
Not applicable

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.

0 Likes