Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/30/2023 in all areas

  1. Since you're using BricsCAD, you can use the isPropertyValid function to test whether the property is valid prior to obtaining it, e.g.: (defun c:test ( / ent ) (if (setq ent (car (entsel))) (if (ispropertyvalid ent "d1~MCAD") (print (getpropertyvalue ent "d1~MCAD")) (princ "\nProperty not valid.") ) ) (princ) )
    3 points
  2. If you use Al Roger's old Lisp code to draw structural shapes (STL.LSP), I have replaced his old 9th Edition AISC shapes with the latest 16th edition shapes. I left his data for the Metric shapes alone since I did not have a source for the dimensions. His Lisp routine reads several DIM files that contain the shape data and I have not touched it. I just replaced his old DIM files with new ones. When I did the DIM files for the 13th edition of AISC, I kept Al's old data and appended a 9th on the end of the shape name and the 13th edition was added onto the end of the data. IIRC, the AISC has a spreadsheet with very old profiles for steel shapes from the late 1800's and the motivated user could add the old shapes at the end of the DIM files. The 16th edition of the AISC shape data includes many new rolled sizes. In order to use the Lisp, you have to unzip the package into a folder in your search path where it loads your LSP files and all the DIM files must be in the same folder so his program can find them along with the help file. I tested the program out on my 2024 version of ACAD and have used it on all prior ACAD versions that I've used for many years. For new users, after you Load the Lisp, you just type STL and his dialog window pops up and you select the shape and size and the 2D End, 2D Top, 2D Side, 3D Sold, or 3D Surface, and the Lisp will draw the shape. I'm a Structural Engineer and use STL to draw the shapes to see if the shape is too close to the anchor bolts on my base plate design. I don't do much drafting and not much Lisp, so I am in awe of the talent that came up with this code. I just occasionally edit the DIM files so it can draw new shapes. Edit--Edit-- I found an error in the Stl_Tube.DIM file and it was corrected with the revised ZIP below. I also edited the DCL file to change the Label for Tubes to HSS which is what the AISC now calls them. I found another error in the LSP code with a divide by 2 producing errors (it should have been /2.0) ) HTH Al's Steel Mill 2023_R1.zip
    1 point
  3. You can use the "X" mode string to interrogate the entire drawing database, with an appropriate filter list to target the block properties that you desire, e.g. for block name you might use the following (though, not that for dynamic blocks you'll also need to test for anonymous references) (ssget "_X" '((0 . "INSERT") (2 . "YourBlockName")))
    1 point
  4. There are a lot of ways to work it out. If it is a standard AutoCAD command then the help and AutoDESK help will tell you what it all does. Some commands can be used from the command line - and they are ideal for LISP. Some commands can only be used via a dialogue box, which can be useful but you can't automate that part. Some commands can be run both ways, command line and dialogue box - command line is good for automation. typically if a command can be run both ways you can get it to run via the command line with a '-' prefix. For example -plot will step through plotting via the command line. To use a command like that you want (command "-yourcommandhere-" -andthing else that is needed here). Yourcommandhere is the command name and any '-' prefx necessary to make it work via the command line. Anything after that is what is needed to make the command work, and you can work out what is needed by running the command in CAD and noting down everything you type, including 'enter'. Type that into the LISP as you go - you;ll pick it up quick enough. One tip that might be useful is if you need a user input you can use pause instead of some information To make things worse there are other ways to do everything, possibly quicker than 'command', but you'll get to that soon enough. I think most of us started as you are doing and copying from the command line to a LISP. In your example, I'll type in 'circle' in the command line and it returns 'specify centre point for circle or [3P 2P TTR (tan tan radius) ]' I'll pick a point, or enter a point 0,0 - now this is text so when I make up the LISP later I'll remember to put it in " " 'Specify radius of circle or diameter' So now I can enter a point as before, or a value, or even pick a point and that is the command complete So make that into a line for a LISP: (command to start to tell the LISP what is about to happen "0,0" - my centre point pause - I decided I wanted the user to pick a point on the radius. In your example the "3,3" is a point, a point on the circumference to select the radius (command "circle" "0,0" pause) Might be that you have a centre point already selected, you can replace anything in the command with a variable. Try these 2 lines: (setq pt (getpoint "Select circle centre point") ; pt is a variable (; on code means comment afterwards) (princ pt) ; princ means display in the command line (command "circle" pt 5) ; make a circle centred on pt with a radius of 5
    1 point
  5. COMMAND in AutoLISP executes an AutoCAD command. It's just like typing the text that follows at your command prompt. Every space between the arguments is like pressing Space or Enter. A good way to write your COMMAND argument is to enter it at your command prompt. If it works there, it will work in AutoLISP.
    1 point
  6. maybe this helps : dynamic block prop
    1 point
  7. Not just you. Won't play at all for me if UCS not set to World. Steve
    1 point
×
×
  • Create New...