Jump to content

Multiple block insertions at co ordinates


Recommended Posts

Posted

Hi guys

 

I received reams of co ordinates in .txt format with which I have to plot cable routes.

Is there any way I can import those co ordinates and use them to place blocks at each co ordinate as quick as possible?

 

I will use a simple X as a block and need to place them at each co ord but cant bear the thought of doing them one by one.

Do I have a choice?

 

Regards

Rob

Posted

Dang it, you are in LT :( all kinds of lisps are availible to and fro Excel-docs...but other than that, I have no idea...

 

If you want just a shown X, not an actual X, I would use Points, the command is POINT and with the variables PDMODE and PDSIZE you can change the appearance of the point, PDMODE = 24 or =25 I think is an X.

 

And then just get typing... put on some music and just zone out..

Posted

Given the nature of your work and the requests you have made over the last few months wouldn't it seem like a good time to consider the possibility of upgrading to a full version of AutoCAD?

Posted

you could write a script file along the lines of:

osmode
0
Multiple
-insert
"insert the path and name of the block you wish to insert"
[color=red]0,0,0[/color]
[color=seagreen]1[/color]
[color=blue]0[/color]
[color=red]10,10,10[/color]
[color=seagreen]1[/color]
[color=blue]0[/color]
[color=red]20,20,20[/color]
[color=seagreen]1
[/color][color=blue]0[/color]

 

whereby the red text are your co-ordinates, the green number is the scale of the block, and the blue number is the rotation of the block

Posted

ReMark - If only it were up to me. Honestly, I do have access to full Autocad, just not at the office. So I work around that as much as possible but in situations like this I may need to saddle up next to a full version.

 

NBC - Ill look at that, thanks.

Posted

NBC - Do I simply put that into Notepad, modify it and then run it in the command line?

 

Ive done it as follows...

 

osmode

0

Multiple

-insert

C:\Documents and Settings\SANDILE1\Application Data\Autodesk\AutoCAD LT 2010\R15\enu\Blocks\LP.dwg

18067.067,-3271588.884,0

1

0

18093.764,3271573.726,0

1

0

18119.774,3271561.862,0

1

0

 

I get an error, before explaining the errors can you see anything blatantly wrong with the syntax?

Please forgive my ignorance, Ive not used scripts before. Once I have a handle on this I I wont ask again :)

Posted

You would put all that into Notepad; then save the Notepad to to a filename of your choice; however, ensure the file extension it is saved to is .scr.

Then close notepad, navigate to where you saved the file to, and drag it into AutoCAD.

 

The only 'error' I can see from the code you posted above is that the filepath and name of the block are not enclosed within quotation marks " "

Posted

Morning

 

Im battling to get this working. It seems the syntax needs tweaking.

I drag the above .scr into the drawing and get the following...

 

Error-1.jpg?t=1254989703

Posted

AutoCAd can't find the block. Insert it by hand prior to run the script, than delete your insert. AutoCAd will keep the block definition.

Or maybe there is a bug in the script file? When AutoCAD expects the block name, it gets C:\Documents

Posted

I can't see your image (not allowed by net-nanny) but stepping through (as suggested by fuccaro) shows me that it also expects a Y scale factor but is reading the 0 - not allowed. You may need to modify it to..

 

 
osmode
0
Multiple
-insert
drawingName.dwg
18067.067,-3271588.884,0
1
[color=red]1[/color]
0

Posted

Maybe

 

[color="DarkGreen"];ADD A Semi colon TO COMMENT. LINES WHICH START WITH A SEMI 
;COLON ARE IGNORED WHEN RUNNING A SCRIPT[/color]
osmode
0
Multiple
-insert
[color="darkgreen"];PATH ENCLOSED WITH A STARTING AND ENDING COMMAS[/color]
"C:\Documents and Settings\SANDILE1\Application Data\Autodesk\AutoCAD LT 2010\R15\enu\Blocks\LP.dwg"
18067.067,-3271588.884,0
[color="darkgreen"];X SCALE[/color]
1
[color="darkgreen"];Y SCALE[/color]
1
[color="darkgreen"];ROTATION[/color]
0
[color="DarkGreen"];block name[/color]
"LP"
18067.067,-3271588.884,0
1
1
0

Posted
I can't see your image (not allowed by net-nanny) but stepping through (as suggested by fuccaro) shows me that it also expects a Y scale factor but is reading the 0 - not allowed. You may need to modify it to..

 

 
osmode
0
Multiple
-insert
drawingName.dwg
18067.067,-3271588.884,0
1
[color=red]1[/color]
0

 

Ahar, I can see now how come I didn't put in a Y scale; as I make all my blocks to scale uniformly so the Y scale is redundant

Posted

Ok Dave that worked. I only ran a single co ordinate as a test but it placed it correctly. The only problem is it asked me to specify rotation. How can I get around doing that?

 

Off to try multiple insertions...

Posted
The only problem is it asked me to specify rotation.
the 0 after the 1s should be the rotation. It is possible you missed a final linefeed so the 0 wasn't being read.
Posted
Ahar, I can see now how come I didn't put in a Y scale; as I make all my blocks to scale uniformly so the Y scale is redundant
this is the touble with scripts, one unexpected question and they go all out of sync. I always forget that if you insert a block exploded you only need to give 1 scale factor.

 

The other thing that can trip you up is the default changing between typed and scripted commands. I have a batch plot script which ends...

 

step through command line

(AutoCAD) - do you want to save changes?

 

from script

(AutoCAD) - do you want to discard changes?

 

It took me AGES to work out why our files were being saved when I didn't want them saved!

Posted

Ok it worked perfectly. Thanks Dave.

Still takes ages to put in the co ords though because they come to me in a .txt and contain a few other categories of info so I have to edit each line. Such an ache.

 

I would have had the same problem had I used LISP wouldnt I?

Posted

depending on how the information is presented you may be able to open the text file in excel. If you can get the information in columns you can then strip out the bits you don't want before saving it again as raw text. You need to be imaginative at times on how you find & replace but you would be surprised at what can be done. And no, I'm not going to do it for you! :)

Posted

Damn! I did try that but couldnt come right. Simply because I dont work much with Excel and when adjusting column widths didnt work I threw in the towel and spent 3 hours doing it the long way round.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...