Jump to content

Command line multiple block insert (coordinates and label text) - need correct syntax


genshijin

Recommended Posts

This is a surveying problem... common one from internet searches.

There are two similar posts (below) on the site but they are not what I'm looking for.

 

 

 

Import points with labels - answer insert points and adjacent text

http://www.cadtutor.net/forum/showthread.php?48491

 

 

Import Survey points to Attributes - answer using lisp programs

http://www.cadtutor.net/forum/showthread.php?33804

 

 

-----------------------------------------------------

 

 

I do not want to use 3rd party lisp programs if I can do it with the multiple command and insert command. I need to keep the point name and additional code text together with the point data so they can be extracted again later together (using adjacent text method is not suitable).

 

 

I am fairly new to AutoCAD and returning to civil engineering after a short (26 year) break... don't things change!

 

I do not have AutoCAD Civil 3D so I need to make the best of features available in just AutoCAD... which are fairly limited for points.

 

 

I have a block (surveypnt) with x,y,z coordinates and one attribute text label. Searching on the internet it appears possible to use the MULTIPLE then -INSERT command to import a lot of points into a block with text attribute. Unfortunately I cannot get any of them to work - all fail if there is anything after the block name. I assume I have the syntax wrong but whatever I try gets nowhere.

 

 

-INSERT BLOCKNAME X,Y,Z SCALE ROTATION ATTRIBUTE TEXT VALUE

 

 

 

Example

 

-INSERT surveypnt 400.123,500.456,25,789 1 0 station1

 

 

I've tried quotes, brackets and other suggestions on the internet but nothing works.

Can this be done inserting coordinates and label values on one line at the command line? If so, where am I going wrong with the syntax?

 

 

Any help much appreciated.

Andy

Link to comment
Share on other sites

Got the answer in another place. As it is hard to find a full answer for this I will post here.

 

 

Can be done quite easily pasting at the command line if you have the syntax right.

 

 

 

Need ATTDAI set to zero to stop pop up box 'Enter Attribute'.

(setvar 'ATTDIA 0)

There are reports osnaps may have an effect as well but I did not see it.

 

 

 

 

Solution

 

 

Data needs to be in this text format - line by line:

 

 

Example X,Y,Z coordinates 200,700,20. Just X,Y also ok if that is set for the block. Followed by scale and rotation (1 0) in my case. In some cases maybe (1 1 0) if x and y different. Then the text attributes you have to enter - same number as the number set in the block.

 

If no text attribute for some blocks you need to enter double quotes with nothing in "" .... I think. If that doesn't work try entering a space " ".

 

 

 

(command "-insert" "BLOCKNAME" "200,700,20" 1 0 "text-attribute-1" "text-attribute-2")

 

 

This works fine for multiple entry of data as long as your text input entered matched the text attributes of your block.

 

 

Start at the command line with:

(setvar 'ATTDIA 0)

MULTIPLE

POINT

(command "-insert" "BLOCKNAME" "200,700,20" 1 0 "text-attribute-1" "text-attribute-2")

(command "-insert" "BLOCKNAME" "200,700,20" 1 0 "text-attribute-1" "text-attribute-2")

(command "-insert" "BLOCKNAME" "200,700,20" 1 0 "text-attribute-1" "text-attribute-2")

(command "-insert" "BLOCKNAME" "200,700,20" 1 0 "text-attribute-1" "text-attribute-2")

etc etc.

Link to comment
Share on other sites

Start back at excel you have points with Pt x y z code pointname in columns you can write the insert commands to a column then copy and paste to command line you do not need it to be lisp based if its a massive amount you can copy the column to notepad and save as a script file and run.

Screen Shot 07-26-18 at 11.55 AM.jpg

Link to comment
Share on other sites

Unfortunately that does not work (just tested). Not in AutoCAD 2017 anyway. That was my original starting point but it fails without the double quotes.

Also without (setvar 'ATTDIA 0) the command stops and opens the Enter Attribute box for the first point.

 

 

For example, in your excel data image, AutoCAD (2017) does not know where the attribute text ends ... is it Point, Point 1, or Point 1 A.

If there are two text attributes there is no way to decide where one ends and the next begins - it cannot decide where to delimit using the spaces between text. That is one reason the quotes are needed.

Link to comment
Share on other sites

I cheated and used Point1 I did not test using ascci characters so you would get the quotes.

 

ok the fix that should work

this is existing 
=CONCATENATE("Insert ",E2," ", A2,",",B2,",",C2," ","1 0 ","point ",A2) and has a gap between point and 1 not working.

=CONCATENATE("Insert ",E3," ", A3,",",B3,",",C3," ","1 0 ",CHAR(34),"point ",A3,CHAR(34)) this uses the char to place a " into the string

Link to comment
Share on other sites

See my post #9 here and #5 here. If the attribute values have space characters in them you will need to bracket their reference in the Excel concatenate command with char(34) (ASCII quote).

Link to comment
Share on other sites

This is the same solution, and same link reference I was given by Lee Minardi. I just posted the answer here for people as there was no reply earlier.

 

 

https://forums.autodesk.com/t5/autocad-forum/multiple-block-insert-coordinates-label-text-from-command-line/

 

 

The only solution so far that works is that one with the command in brackets (depending on scale factors, 1 0 could be 1 1 0):

 

 

Start at the command line with:

(setvar 'ATTDIA 0)

MULTIPLE

POINT

(command "-insert" "BLOCKNAME" "X,Y,Z" 1 0 "text-attribute-1" "text-attribute-2")

(command "-insert" "BLOCKNAME" "X,Y,Z" 1 0 "text-attribute-1" "text-attribute-2")

(command "-insert" "BLOCKNAME" "X,Y,Z" 1 0 "text-attribute-1" "text-attribute-2")

(command "-insert" "BLOCKNAME" "X,Y,Z" 1 0 "text-attribute-1" "text-attribute-2")

 

 

 

 

Only with that exact format/syntax does it work on AutoCAD 2017.

Link to comment
Share on other sites

Same answer I got over there. I posted here for others as there was no early reply.

 

 

https://forums.autodesk.com/t5/autocad-forum/multiple-block-insert-coordinates-label-text-from-command-line/

 

 

So far... only that exact format/syntax works in AutoCAD 2017.

 

 

1 0 scale factor could be 1 1 0 if x,y different.

 

 

Example

(command "-insert" "your-block-name" "X,Y,Z" 1 0 "your-text-attribute1" "your-text-attribute2")

 

 

(command "-insert" "SURVEYPNT" "200,700,20" 1 0 "pnt01" "")

(command "-insert" "ATTPOINT" "300,700,20" 1 1 0 "pnt02" "hedge")

(command "-insert" "point-code" "210,720,20" 1 0 "pnt03" "ditch")

Link to comment
Share on other sites

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...