Author Topic: WRITING SCRIPT FILES  (Read 14422 times)

0 Members and 1 Guest are viewing this topic.

tcopeland

  • Guest
WRITING SCRIPT FILES
« on: October 13, 2009, 05:52:41 PM »
This may be in the wrong forum here but it does have to do with spatial data.   :|  Feel free to move this if it does need to go somewhere else.

I am trying to write a script that would insert a variety of points.  These points are coordinates for different facilities; substations, towers etc.  What I want to do is take the data that I have and insert a block for that particular set of facilities.  Within the block I have defined a set of attributes that would tie back to a database, spreadsheet etc.  What I have found is that I can not get the info to fall into the correct location for the attributes.

This is what I have done:
-insert "Y:\Drawings\Blks\substation.dwg" 10000000.00,1000000.000,0 1  0 05 abc Substation

The bolded letters above is the attribute information.  If I do the insert command as I have listed above the bolded section all goes to the first attribute and then the next insert command goes to the second attribute and so on ..... until they are all done.  NOT HOW I WANT IT TO WORK!

If I were to separate the attributes out listing them below the insert command it all works fine.  But I really don't want to do that for a thousand entries.  Is there a command or a certain way to force the script to do a hard carriage return in a line sequence?  I know that a space acts as a return but it does not work while trying to insert multiple blocks with attributes.  So is there another way to accomplish what I am trying to do above, or is there an easier way to get the same result.

Thanks for the help,

Bob Wahr

  • Guest
Re: WRITING SCRIPT FILES
« Reply #1 on: October 13, 2009, 06:35:04 PM »
-insert "Y:\Drawings\Blks\substation.dwg" 10000000.00,1000000.000,0 1  0
05
abc
Substation
-insert "Y:\Drawings\Blk...

tcopeland

  • Guest
Re: WRITING SCRIPT FILES
« Reply #2 on: October 14, 2009, 08:34:37 AM »
If I were to separate the attributes out listing them below the insert command it all works fine.  But I really don't want to do that for a thousand entries.  Is there a command or a certain way to force the script to do a hard carriage return in a line sequence?
-insert "Y:\Drawings\Blks\substation.dwg" 10000000.00,1000000.000,0 1  0
05
abc
Substation
-insert "Y:\Drawings\Blk...

I have tried that and it does work but that is not going to be helpful for the amount of data I would like to bring in.  I would need to then re-write all of the text from the text file to do what you have listed above.  Is there another way to get the same results?  Is there a way to force the script to recognize the attributes or is what you have shown the only way to accomplich this?

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #3 on: October 14, 2009, 08:46:28 AM »
Todd,

This looks like a job for your Description Key Sets and the additional point attribute method we worked out.
Don't insert these as blocks with attributes, so much as insert them as Points.
Then when that is done, save the file, and then create your Database links. 
You will find that by using the database linking, that you won't have to attach all that information to the points/blocks that represent those facilities; as attributes, as it will all be available via the database connectivity.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

tcopeland

  • Guest
Re: WRITING SCRIPT FILES
« Reply #4 on: October 14, 2009, 09:21:16 AM »
I didn't stat that these points are not points that have survey codes, these points were derived from a lat long coordinate then converted into a grid format.  I was trying to use MAP to insert the points through the insert command then the plan was to link them using the database connection method you described.  I could go the route that you are referring to.  I was trying something simple to just insert a block with attributes and then wanting to tie that info to the database.  It didn't take long to write the script it was the beating I took afterwards trying to get the attributes to show up. (there needs to be a smiley with tweety birds for that kind of beating)

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #5 on: October 14, 2009, 09:46:34 AM »
the point is they do not have to be 'SURVEY' points in order to make the process work as described.
they have coordinate pairs, and they have attributes...therefor they are perfect candidates to use points, and description keys on...
then you wouldn't have been beat upon by scripting in order to get all those hard returns in the script in the right places to match your block attributes...

just a comma delimited file...that you would treat as if they were 'survey' points and leverage the power of C3D first, and then apply MAP to the resultant....
Be your Best


Michael Farrell
http://primeservicesglobal.com/

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #6 on: October 14, 2009, 12:58:19 PM »
Upon pondering this a little more; and taking the fact that C3D objects (this includes Points) can not be queried by Map, I must revise this suggestion as follows:

I would use your file to insert a very simple point object, say something like a Point number label inside a circle.
I say this because; after you insert your points to get this Circle with text inside it, your next step is to then Export to Autocad
Open that file
Create a Link Template
Then you use the Enclosed Text method of creating your database links using the unique identifier (Point Number) to create the link template. In your case it might be that you use one of your attributes, or the description as the unique identifier.
No Script or Description keys required.

(you might also try this with the Description Key method, and see if exporting the data to SDF proves to be more or less effective)
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Bob Wahr

  • Guest
Re: WRITING SCRIPT FILES
« Reply #7 on: October 14, 2009, 06:52:14 PM »
I'm not trying to disagree with Michael.  Map/C3d/et al are his bailiwick and I would definitely follow his advice.  You can very easily modify your current script using something like notepad++(http://notepad-plus.sourceforge.net/uk/site.htm)  Just replace all of your spaces with hard returns.  Judging by the line you posted, it should work fine.  Do the replace like the attached.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #8 on: October 14, 2009, 07:13:33 PM »
no problem with alternates Bob...that's one of the strengths of autocad...
given that his destination with the data is GIS, I think the last process would serve his needs best...combined with the tools he has to work with C3D/Map.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

tcopeland

  • Guest
Re: WRITING SCRIPT FILES
« Reply #9 on: October 15, 2009, 11:07:56 AM »
I'm not trying to disagree with Michael.  Map/C3d/et al are his bailiwick and I would definitely follow his advice.  You can very easily modify your current script using something like notepad++(http://notepad-plus.sourceforge.net/uk/site.htm)  Just replace all of your spaces with hard returns.  Judging by the line you posted, it should work fine.  Do the replace like the attached.

no problem with alternates Bob...that's one of the strengths of autocad...
given that his destination with the data is GIS, I think the last process would serve his needs best...combined with the tools he has to work with C3D/Map.


I have tried both methods as listed above.  I did try your way first Michael, that did work but when I went to import in the SDF file it did not place the information incorrectly on the drawing.  It appeared that it wasn't scaled quite right, or something.  The points basically were extended beyond our service area.  Not good!  So I went to the next method.  I had to do a little work with the original file but i was able to import the blocks with the attributes.

Thanks for all of the help.  I plan on trying to export out the block data as SDF and re-import the info to see how it differs from the previous import.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #10 on: October 15, 2009, 11:13:38 AM »
and your units and zone were set to???

and you used this method here: http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=7146338&linkID=9240857

Issue


In Autodesk Map® 3D, you want to access a drawing with Civil objects that were created with Autodesk® Civil 3D®.

Solution


To access Civil objects in Autodesk Map® 3D, you need to export the data to SDF format from Autodesk® Civil 3D®. Follow these steps:

1.  In Civil 3D, on the File menu, click Export > Export to SDF.
2.  In Map 3D, Display Manager, click Data > Add Data.
3.  Connect to and add the exported SDF to the map.
?
« Last Edit: October 15, 2009, 11:21:46 AM by mjfarrell »
Be your Best


Michael Farrell
http://primeservicesglobal.com/

tcopeland

  • Guest
Re: WRITING SCRIPT FILES
« Reply #11 on: October 15, 2009, 11:21:04 AM »
Units for the points are in UTM83-14F and the drawing was set to the same coordinate zone prior to importing the points unsing C3D.  When I created the SDF it asked what zone and that was also the same.  When I inserted the SDF into MAP the zone was set to the same for the SDF coming in and also the drawing.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #12 on: October 15, 2009, 11:25:15 AM »
in otherwords, the output, and the input file were both set to the same, and somehow the data STILL got scaled?
this might be something you need to report to your dealer so they can escalate a support/bug report for you...

Let's see what your other tests reveal.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

tcopeland

  • Guest
Re: WRITING SCRIPT FILES
« Reply #13 on: October 16, 2009, 08:15:17 AM »
Well after a day of testing and confusion, I have found that I have some bad lat long data! :roll:  It does appear that both the SDF and the points that I inserted using the script are lining up.  So i will be able to use either method to get the points in that I need, when needed.  8-)

Thanks for the help.

P.S. thanks Bob for the link to notebook++ that is a very handy tool to have in the toolbelt!!

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: WRITING SCRIPT FILES
« Reply #14 on: October 16, 2009, 09:16:32 AM »
OK, that was one of the suspects....good to know it isn't just 'scaling' data without a cause.   ;-)
Be your Best


Michael Farrell
http://primeservicesglobal.com/