Author Topic: Getting entities that are located within the boundary of another entity  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

murrdpirate

  • Guest
I'm trying to create a routine that will name architectural spaces based on room tags, but I can't figure out how to get my program to check for room tag blocks within the space boundaries. 

I've been searching the forum and found things like boundingboxintersectwith, but that only tells if you if two entities intersect with each other.  I suppose I could use that to compare every room tag to each space, but I'd rather grab every entity that intersects with the space and choose the entity that is a room tag.  I've also been trying to figure out how to get the vertices of the space but I can't figure it out.

Any ideas? 

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>


Welcome to theSwamp.

Which AutoCAD product are you using ??

Some of the terms you've used I'm not familiar with, and I assume others will be in the dark too :)

Consider attaching a drawing perhaps ...

Are you using COM or the managed API ?
 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

murrdpirate

  • Guest
Thanks for the welcome!

I'm using AutoCAD MEP 2011 and managed code.  I believe that MEP also includes everything in AutoCAD Architecture (and vice versa). 

A "space" is a an entity that is used to display information about a room within a floor plan.  Basically, the space feature allows you to analyze a floor plan of lines and walls and determine where the rooms are.  It will attempt to trace features such as walls and windows, giving you a polygon for each room.  It's useful for HVAC because it can give things such as floor area, exterior wall and window areas, and other information that is useful for heating and cooling load calcs.

Tracing a room with a polyline and filling it with a hatch is essentially what a space looks like, although I'm not entirely sure exactly how its shape is stored in the dwg database.  But I think it should be relatively easy to get its geometry and then find all entities within that geometry. 

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>


Just noticed your post on forums.autodesk and saw your ref to MEP.

I don't have MEP, so I'd be guessing, sorry.

Are the objects accessable in the Managed API ?? I assume there'd be a dedicated .DLL <perhaps>
If so, perhaps some trial and error testing may be productive ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

murrdpirate

  • Guest
Here's a picture of 3 spaces I created for 3 rooms.  I've selected the space for the CONF Room and am viewing its properties.  You can see in the properties box that the name for this space is "Space (3)."  That's the basic problem: spaces are automatically named space(1), space(2), etc as you create them.  You can only manually change each space's name.  

If you look inside the space, you can see the room tag that says "CONF. 15x24."  I made a program that will change the space name based on the room tag, but the user has to select both.  What I want to do now is have the user select just one room tag and automatically name each space based on the room tag that is within the space's boundaries.

murrdpirate

  • Guest
Yeah the objects are accessible in the API, and there are a ton of functions associated with spaces, but I'm kinda slow in figuring it out.  I've already spent about 4 trying to get it and I was kinda hoping someone could just tell me the answer.  :-)

It can be tough to test functions because a lot of the time I don't even understand what variables they're asking me to pass.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>

You may be assisted using the 'Locals' window when debugging ( using step through )

Debug-> Windows->Locals

I've found this a great aid in deciphering properties.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

murrdpirate

  • Guest
Theres a GetObjectSnapPoints function for the Space class.  Obtaining the endpoint snap points would give me the outline of the space, but there are so many damn variables to pass and I have no idea what most of them are.  Why can't you just give it the objectID, the snap point type, and get a list of points??

Edit: holy crap I think I finally got it.  Found an example of GetObjectSnapPoints here: http://forums.autodesk.com/t5/NET/GetObjectSnapPoints-example/m-p/2280220/highlight/true#M10805

Hopefully I can get it to work without user interaction though..
« Last Edit: June 11, 2010, 01:51:23 AM by murrdpirate »