AutoCAD Map 3D Forum
Welcome to Autodesk’s AutoCAD Map 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic query

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
Projectmax1
700 Views, 15 Replies

Automatic query

 

I've been trying to work out how to generate a whole lot of smaller drawings from a bigger drawing, automatically through Scripting and Lisp programming. Each of these smaller drawings would be based on a rough 20 metre buffer of the property boundaries inside it. Each drawing created would preferrebly be the expression of the House number + Street name, which are in each property boundary parcel as object data. What I have been doing in the past is attaching and querying the required drawing one by one but this takes a while and we are about to get a whole shed load more to be done. This is not easy and probably can't be done, and the way I have tried to explain it won't be helping either. But if anyone has any suggestions that would be great.

 

Thanks

15 REPLIES 15
Message 2 of 16
tjmapper
in reply to: Projectmax1

What version of map do you have?

 

Have you looked into workflows?

Message 3 of 16
Murph_Map
in reply to: Projectmax1

You talking about the map attach query correct and none of the FDO stuff. It's possible and can be done with lisp. Years ago I did it to bring in electrical distribution lines based on the area they were in and the phases/voltage that was in the OD tables or drawing layers they were on. Even went as far as having a dialog box open letting me select what are I wanted. The old school ways still rules in my book.

 

Murph
Supporting the troops daily.
Message 4 of 16
tjmapper
in reply to: Murph_Map

That does sound ideal.

 

I looked into going about it with data connections and workflow, but you dont have the option to "Add to map with Query" through workflow. That kinda ruins my idea. Smiley Sad

 

Maybe in 2012.

Message 5 of 16
Murph_Map
in reply to: tjmapper

The problem with your data connect method is the OP is using Object Data not SDF/Shp or any other feature type. Which means any time a drawing is updated it needs to be converted to SDF or what ever.

Murph
Supporting the troops daily.
Message 6 of 16
tjmapper
in reply to: Murph_Map

I understand that now. Was just trying to see if it were possible by this method.

Message 7 of 16
Projectmax1
in reply to: Projectmax1

 

Thankyou both for your replies. We are using Autocad Map 3d 2011. I've only been using Cad for 2 & a half years though, so my lisp skills are almost non-existant, thats why I was kinda hoping you would say it's not possible Murph haha.

The parcels did come from shape files & it doesn't matter how I get to my solution. And even if I can't do it all automatically, every little bit I can get my machine to do for me saves time & sanity. Murph your electrical drawing stuff sounds very close to what I need. You wouldn't have the lisp code handy would you?

 

Thanks again

Message 8 of 16
Murph_Map
in reply to: Projectmax1


@Projectmax1 wrote:

 

....... You wouldn't have the lisp code handy would you?

 

Thanks again


I just did a quick look and didn't see them in my external HD I might have them on a dvd someplace, then again I may not. If you know how to create a query and a little lisp it's not hard to do.

Murph
Supporting the troops daily.
Message 9 of 16
Projectmax1
in reply to: Murph_Map

No worries at all. I did have a go at it, the main problems so far are the various windows that pop up which aren't compatible, with scripts anyway, such as 'define query of attached drawing'. And ideally I would like to tell it which property boundaries to extract as drawings and go home for the night. Like I said though, any short cuts are very welcome.

 

Sigurd

Message 10 of 16
cjneper
in reply to: Projectmax1

Check out http://www.4d-technologies.com/ under Free Stuff and Autocad Map category.  The programs for querying the object data were very helpful to me.  I have a dataset of parcel polygons that I import from a shape file, with object data attached including owner name, address, etc.  I run automated queries of that data to bring up the associated parcel polygons for custom maps.  Sounds similar to what you are looking for.

Message 11 of 16
Projectmax1
in reply to: Projectmax1

 

Thanks for that. I did get there in the end, the method was unorthodox but it worked. Kind of.

What I did was export the address coodinates to an excel spreadsheet, manipulated it a bit, added bits & pieces and converted this spreadsheet to a .scr file.

But what is driving me crazy is that this script file which I can run in scriptpro for thousands of drawings/properties CHANGES for each drawing. -As in, it works perfectly for some, but not for others. When I check the script file & log file from scriptpro, there are no mistakes. The script instructs autocad to select objects within sepecified coordinates, but autocad seems to ignore these coordinates and select some other objects it chooses randomly.

What gets me is that it does actually work for some, but not for others with the exact same instructions (just different coordinates).

What made me add to this discussion though is that i'm working on a script to simply change a logo for a whole lot of drawings. (which i thought would be very straight foward.) I've attached the log file from scriptpro to show you whats going on. I loaded up two drawings which for this scenario are EXACTLY the same.

Yet if you scroll down and compare the MOVE and ERASE commands in the two drawings. The results are quite different. I really don't know whats going on & would appreciate some help. (Yes the script is messy)

 

Thanks

Message 12 of 16
Murph_Map
in reply to: Projectmax1

What I see in your script file is you are opening the a block in the block editor, erasing objects, inserting an image and scaling, moving,setting draw order then saving that block. Where the difference in number of items selected it may be some objects in the blocks, either someone,something or somehow over time either something was added to them or deleted out of them. The delete may of happen with a laydel command being used or a super purge in those drawings. If there's extra objects in them it may be nil text or attribute tags or something was added someplace along the way. If you have a good numbers of dwgs that have been around for a while it's possible something changed in each block.

 

If those blocks and logos are in model space this is a good example of when you should use paper space for logos. Years ago a place I worked have the title blocks with logos in model space (R12 version) I converted them all over to paper space layouts and a few years later when the company changed it's logo it was only a matter of updating the layouts, by importing a new layout and deleting the old layouts.

 

One thing you can try is use the Reference Manager and repath the images to the new one. The reference manager is a stand alone apps that is part of the install options.  or maybe replace the image with the new image with the same name.

Murph
Supporting the troops daily.
Message 13 of 16
Projectmax1
in reply to: Murph_Map

 

Yes you are right. It is a titleblock in paperspace. The logo I want to get rid of is a block which is inside the titleblock, & replace it with the new logo which is an image. The problem you suggested of hidden objects could be true, however the objects which are erased, are actual objects visable around the old logo, OUTSIDE the selection box instructed.

I tried to redefine the block with the new image, which worked but whatever coordinates i tell it to import the image at, it always brings it in 10mm either side of where I tell it. Just like the script for the property parcels, but in that case, some worked & some didnt. I'll attach a sample from that script (I didnt have the full addresses at the time but you get the idea)

 

Thanks

Message 14 of 16
Projectmax1
in reply to: Murph_Map

 

Ok after much jiggery pokery I got the image into the correct place using block redefine. Thanks a lot for your help.

Message 15 of 16
cjneper
in reply to: Projectmax1

One thing I noticed in your script is you are erasing items with a window selection.  Autocad will not select items with a window if they are offscreen, so if any entities are not visible onscreeen, that would explain them not being erased.  It is much safer to use a ssget selection set and erase that.

Message 16 of 16
Projectmax1
in reply to: Projectmax1

 

That actually explains a lot!! Thanks Smiley Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost