.NET

Reply
Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 1 of 8 (437 Views)

SelectionSet objects

437 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
fxcastil
Posts: 404
Registered: ‎11-11-2002
Message 2 of 8 (433 Views)

Re: SelectionSet objects

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

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.

 

 

*Expert Elite*
_gile
Posts: 2,133
Registered: ‎04-29-2006
Message 3 of 8 (425 Views)

Re : SelectionSet objects

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

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
Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 4 of 8 (384 Views)

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

 

 

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

 

Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 5 of 8 (373 Views)

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*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 6 of 8 (366 Views)

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

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 7 of 8 (355 Views)

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

 

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?

Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 8 of 8 (348 Views)

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
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.