Jump to content

AutoCAD command syntaxes


Matielo

Recommended Posts

There is a borehole extension available for Autocad put out by Autodesk may be worth looking at. Can not remember exact name.

 

Your home work is do some googling I would have to also to find it again. "Borehole Extension Autocad"

 

Just a bit more you can make a csv file of your points and then read that file into a pline command fairly easy again Google, ok now for the real smart way, open the excel file with the points say 2 columns, run a lisp in Acad it will ask you to select range in excel, wow pline made. The excel stuff needs a bit of learning 1st but there is a wealth of examples out there.

 

image.png.3e9698ec24f0583e78bfb959ca3aad59.png

Edited by BIGAL
  • Like 2
Link to comment
Share on other sites

I have used getexcel ( https://autolisp-exchange.com/LISP/GetExcel.lsp ) but is it very slow it reading from an excel file. It is a lot quicker to save the file as a CSV file and read the data from that. LISP looks at these as if they are just plain text files and again, loafs of examples out there

 

Interested to see if either of you can get the borehole extension and to have a go with it

 

Link to comment
Share on other sites

I found getexcel had a couple of say needed items so wrote my own, but the getrange above was by Fixo and I have since got another ZIP file with heaps of his excel functions in it but again you need to understand how the Excel <-> Autocad works. Please note you can run Autocad from excel using a excel macro the reverse of the same functions but in Excel. Look at Alan3

 

 

draw object xl acad.xlsm

  • Like 1
Link to comment
Share on other sites

On 10/7/2022 at 7:51 PM, Jonathan Handojo said:

It's definitely a long journey to learn this language. I would have already posted a solution if I wanted to, but seeing the amount of effort you've put into learning, I thought I'd step back and see how you do, whilst at the same time offer any insights and suggestions when you're stuck. I think others feel the same way. So far you're doing great and learning a bunch.

 

Speaking of suggestions: instead of a polyline with a hatch, it appears that your task seems doable by just drawing the polyline top down, whilst setting the polyline thickness in the beginning (unless you need a different hatch pattern of course). So instead of:

 

    (command "_.rectang" MyPt (mapcar '+ (list MyW MyH 0) MyPt))
    (command "-hatch" "S" (entlast) "" "")

 

You could set the polyline thickness before the repeat loop using:

(setvar "PLINEWID" MyW)

 

and then draw the polyline like so:

(command "_PLINE" MyPt (mapcar '+ MyPt (mapcar '+ MyPt (list 0 MyH 0))) "")

So then it saves having to do an extra command.

 

On a note, if you'd like, I can create a sample command to show another approach in which it could be done, all layers considered. I would only need the sample csv file with all the information. If you needed to input the text on the right manually, it defeats the efficiency purpose, so then what you've got is fine.

 

I saw the pline width variable when i was first learning how to use pline command. I guess i did not try it because i was doing ok figuring out how to do it with a rectangle but it makes much more sense to use only a pline. First of all because theres no need to make any calculations on x position. Plus the hatch is also not needed, only the solid color. I dont know if its my perception or what but isnt the hatch command slow? Specially when theres hundreds and hundreds of rectangles...

 

I am really intrigued to know what is that another aproach you talked about. What do you mean by all layers considered? ps.:no i dont need to put the text manually. It would be so painful to do that.

 

I think i have to explain how im doing right now. I have an excel spreadsheet that assembles the command codeline in a cell. I get the list of cells and paste into a notepad and save it as .scr to drag and drop to ACad.

Test_SP01_SPT_forum.xlsx text doc to dragn and drop into autocad as scr.txt

Link to comment
Share on other sites

On 10/8/2022 at 12:49 AM, BIGAL said:

There is a borehole extension available for Autocad put out by Autodesk may be worth looking at. Can not remember exact name.

 

Your home work is do some googling I would have to also to find it again. "Borehole Extension Autocad"

 

Just a bit more you can make a csv file of your points and then read that file into a pline command fairly easy again Google, ok now for the real smart way, open the excel file with the points say 2 columns, run a lisp in Acad it will ask you to select range in excel, wow pline made. The excel stuff needs a bit of learning 1st but there is a wealth of examples out there.

 

image.png.3e9698ec24f0583e78bfb959ca3aad59.png

I dont know if its the same you are talking about but theres a plugin called Geotechnical Modeler. The only thing is that it does not support any customization in presenting the data. The plug in is very good because it makes possible to work the geological data in a BIM way, but not so good in presenting that data.

 

The ultimate goal here is to have the geological data presented in a BIM environment (3D boreholes and surfaces in Navisworks) and the borehole drawings in the roadway profile section.

Link to comment
Share on other sites

Using a polyline to make a rectangle sort of makes me cringe, might be me though, for a couple of reasons. One is that one in our CAD team makes dots out of polylines, so when I use my LISP to line everything up, ignores polylines (for other reasons) then these dots are left behind, and it is quite easy to highlight all and set polyline widths to anything you want, harder to do that with a rectangle.

 

If it was me I would be making the filled rectangle as a block and insert as and when, perhaps also the empty rectangle, calculating only the Y position.. but that is a couple of steps ahead of "how do I make a rectangle with a command in a LISP".. small steps of course

 

Next step would be learning how to entmake elements, lines and so on and converting your LISP to that, it is a great way to see which method you prefer - I do both depending on the situation. After that entmake and make a block at the same time

Link to comment
Share on other sites

Need some help working with lists.

 

Here's what i'm trying to do:

Set a list of lists: List B { }, List S [ ] and List N ( ).

B = {S1, S2, S3, ..., Sn} -> List of boreholes;

S1 = [SP, 106, (N1)] -> List of borehole parameters;

N1 = (0, 2, 6, 6, 14, 18) -> List of borehole NSPT values;

S2 = [SP, 150, (N2)];

N2 = (0, 1, 1, 4, 8);

It would look like this: { [SP, 106, (0, 2, 6, 6, 14, 18)], [SP, 150, (0, 1, 1, 4, 8)] }.

This way i can access a specific Borehole say 0 (first one), get the 2 (third argument) and run a loop to write a polyline for each value of the list (the y is increased by a constant say 10). So the polyline vertex would be (0, 0); (10, 2); (20, 6); (30, 6); (40, 14); (50, 18). The drawing would be something similar to the image.

It would simplify the way i'm using excel because each line would not be a command anymore, it would be just an append. Is there a way of working with lists this way?

polyline.bmp

 

 

-edit-

Found the right syntaxe to append new numbers to a list. Now figuring out how to loop a pline command through them for eath Borehole.

Edited by Matielo
Have advanced on the coding
Link to comment
Share on other sites

23 hours ago, Matielo said:

I am really intrigued to know what is that another aproach you talked about. What do you mean by all layers considered? ps.:no i dont need to put the text manually. It would be so painful to do that.

 

Earlier you mentioned you'd like it so that the layers of the texts and everything would be better off being separate, so that editing becomes easier. So that's what I thought you meant.

 

Follow the format as shown in the attached CSV and the following LISP code should be what you're after. I've left flexible settings at the beginning of the code, in case you want to tamper around some settings. Though, I wasn't too sure what the first column in that file is supposed to do.

Sample Borehole.csv

Borehole.lsp

Edited by Jonathan Handojo
  • Like 1
Link to comment
Share on other sites

35 minutes ago, Jonathan Handojo said:

 

Earlier you mentioned you'd like it so that the layers of the texts and everything would be better off being separate, so that editing becomes easier. So that's what I thought you meant.

 

Follow the format as shown in the attached CSV and the following LISP code should be what you're after. I've left flexible settings at the beginning of the code, in case you want to tamper around some settings. Though, I wasn't too sure what the first column in that file is supposed to do.

Sample Borehole.csv 676 B · 0 downloads

Borehole.lsp 6.13 kB · 0 downloads

It gives the error "bad DXF group (1)" after selecting the insertion point...

 

I mean, oh lord theres a lot of list manipulation going on...

Edited by Matielo
Link to comment
Share on other sites

Hmm, it seems to be working fine on my end. Did anything appear at all? Did you changed or delete any columns from the attached CSV file? Some snapshots would be useful as well.

Edited by Jonathan Handojo
Link to comment
Share on other sites

14 minutes ago, Jonathan Handojo said:

Hmm, it seems to be working fine on my end. Did anything appear at all? Did you changed or delete any columns from the attached CSV file? Some snapshots would be useful as well.

 

Did not change anything at all. I loaded the lisp with "load application" then ran the comand bh.

errorgroup.png

Link to comment
Share on other sites

Because you have done a good job in excel working out the draw code for Acad did you look at my excel it has a draw a pline in Acad but controlled by excel so no need for the copy and pasting. A google for text would give code. Use draw text VBA Autocad.

 

Oh yeah if you use =concatenate in Excel and join all your Acad columns into one column can just copy and paste that 1 column direct to the command line. Should work.

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