Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. I will add the set property later but this is front end as an example, just copy all the code and paste to command line . (defun wow ( / fo ) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line " dyntruss : dialog { " fo) (write-line " label = \"Enter Values\" ; " fo) (write-line " : column { " fo) (write-line " width =25; " fo) (write-line " spacer_1 ; " fo) (write-line " : edit_box { " fo) (write-line " key = \"key1\" ; " fo) (write-line " label = \"Length \" ; " fo) (write-line " edit_width = 5; " fo) (write-line " edit_limit = 4; " fo) (write-line " is_enabled = true ; " fo) (write-line " allow_accept=true ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : edit_box { " fo) (write-line " key = \"key2\" ; " fo) (write-line " label = \"Angle \" ; " fo) (write-line " edit_width = 5; " fo) (write-line " edit_limit = 4; " fo) (write-line " is_enabled = true ; " fo) (write-line " allow_accept=true ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : radio_row { " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb1\" ; " fo) (write-line " label = \"Flipped\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb2\" ; " fo) (write-line " label = \"No Flip\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " ok_cancel ; " fo) (write-line " } " fo) (write-line " } " fo) (close fo) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "dyntruss" dcl_id) ) (exit) ) (set_tile "key1" "10") (set_tile "key2" "0") (set_tile "Rb1" "1") (action_tile "accept" "(setq val1 (atof (get_tile \"key1\")))(setq val2 (atof (get_tile \"key2\")))(setq val3 (get_tile \"Rb1\"))(done_dialog)") (action_tile "cancel" "(setq cancel \"yes\")(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (if (= val3 "1")(setq visibilty "Flip")(setq visibilty "Noflip")) (princ) ) (wow)
  3. Thanks @devitg it works great!
  4. Today
  5. Maybe this. Does numbers and alphas, as well as a square or circle. Pt num bubble.lsp
  6. You don't use a look up table, as you mentioned just answer the question for length, then add the various blocks selecting the visibility state, you insert the block then call the dcl so can pick which visibility you want then its updated much easier that picking the Blue square and then selecting visibility. Post a new sample dwg with the separate blocks maybe a couple of different structures. Then can look at automating it.
  7. Yesterday
  8. ... And the system variable would still remains you set it firstly. Right?
  9. Hi I am writting a lisp to draw 2d stair. The idea is to select the fist step --> move it to layer STAIR then pick two points for the length of the stair and give the number of the steps. Then the code draw the stair with direction arrow in the middle. The code work perfect if i select the two points only from the one side of the stair. Is not all the time the left or the right side depends of the rotation. Can any one help me to update the code to work for bouth sides and don't misalign the steps. Here is the code . By the way i use ZWCAD. (defun c:Stair2D (/ p1 p2 ent ent_data step_start step_end step_vec stair_vec num_steps i base_pt new_p1 new_p2 mid1 mid2 last_base last_p1 last_p2 arrow_p1 arrow_p2 arrow_p3) (vl-load-com) (setvar "CMDECHO" 0) (command "._UNDO" "_BEGIN") (if (not (tblsearch "LAYER" "STAIR")) (command "_layer" "_m" "STAIR" "_c" "90" "" "") ) (setvar "CLAYER" "STAIR") (princ "\nSelect the first step of the staircase: ") (while (not (setq ent (ssget ":S" '((0 . "LINE"))))) (princ "\nTry again!! ") ) (command "._CHANGE" ent "" "_P" "_LA" "STAIR" "") (setq ent_data (entget (ssname ent 0))) (setq step_start (cdr (assoc 10 ent_data))) (setq step_end (cdr (assoc 11 ent_data))) (setq step_vec (mapcar '- step_end step_start)) (setvar "OSMODE" 1) (setq p1 (getpoint "\nSelect the start of the staircase: ")) (setq p2 (getpoint p1 "\nSelect the end of the staircase: ")) (setvar "OSMODE" 0) (initget 7) (setq num_steps (getint "\nEnter the number of steps: ")) (setq stair_vec (mapcar '(lambda (a b) (/ (- b a) num_steps)) p1 p2)) (setq i 1) (while (<= i num_steps) (setq base_pt (mapcar '+ p1 (mapcar '(lambda (x) (* x i)) stair_vec))) (setq new_p1 base_pt) (setq new_p2 (mapcar '+ base_pt step_vec)) (command "._LINE" new_p1 new_p2 "") (setq i (1+ i)) ) (setq mid1 (mapcar '(lambda (a b) (/ (+ a b) 2.0)) step_start step_end)) (setq last_base (mapcar '+ p1 (mapcar '(lambda (x) (* x num_steps)) stair_vec))) (setq last_p1 last_base) (setq last_p2 (mapcar '+ last_base step_vec)) (setq mid2 (mapcar '(lambda (a b) (/ (+ a b) 2.0)) last_p1 last_p2)) (command "._line" mid1 mid2 "" "" "_N") (command "._CIRCLE" mid1 0.06) (setq mid1mid2_vec (mapcar '- mid2 mid1)) (setq mid1mid2_length (distance mid1 mid2)) (setq unit_vec (mapcar '(lambda (x) (/ x mid1mid2_length)) mid1mid2_vec)) (setq perp_vec (list (- (cadr unit_vec)) (car unit_vec) 0.0)) (setq arrow_p1 (mapcar '+ mid2 (mapcar '(lambda (x) (* x 0.10)) unit_vec))) (setq arrow_p2 (mapcar '+ mid2 (mapcar '(lambda (x) (* x -0.15)) perp_vec))) (setq arrow_p3 (mapcar '+ mid2 (mapcar '(lambda (x) (* x 0.15)) perp_vec))) (command "._LINE" arrow_p1 arrow_p2 "") (command "._LINE" arrow_p1 arrow_p3 "") (command "._UNDO" "_END") (setvar "CMDECHO" 1) (setvar "CLAYER" "0") (princ) ) Thanks Drawing2.dwg
  10. First, the code sets CMDECHO to 0 to prevent program from displaying commands like MLEADER or its interactions in the command line. This helps keep cleaner while the program runs. At the end of the program, the code resets CMDECHO to 1, which is AutoCAD's default setting. I copied my old file into this one, so I probably forgot to remove that line. But in this code, it's not necessary. The command will cancel.
  11. Good start. A few points if you like: - what would happen if a user pressed ESC while Mleader command is active? - What's the need of function vl-load-com in your routine? - You assumed that the system variable CMDECHO was set to 1 but it could be the contrary.
  12. Problem is we cannot always set the length prior to flip as we need to find the right size after the flip. I am trying a few different methods hopefully I can get this to work
  13. @HypnoS use the previous, reattached, It will ask for distance only once , and ask for the straight line start point to paste each block cpy-blk-2-poly.lsp copy block 2 poly 2025-08-05 10-37-41.rar
  14. Here's the code. I hope this helps you. The MLeader style follows your current style. Looking for tools to speed up your workflow? Explore this resource: https://lispautocad.gumroad.com/l/eezilo (defun C:DV_MLP (/ pt x y text) (vl-load-com) (setvar "CMDECHO" 0) (setq pt (getpoint "\nPick point: ")) (if pt (progn (setq x (rtos (car pt) 2 3)) (setq y (rtos (cadr pt) 2 3)) (setq text (strcat "(" x " ; " y ")")) (command "._MLEADER" pt pause text) ) (princ "\nNo Point selected!") ) (setvar "CMDECHO" 1) (princ) )
  15. Think this can also be done with dynamic blocks less automated but will prompt you for inputs when inserted into a drawing.
  16. Now that I think about it... let's assume there will be multiple attributes.
  17. There has to some consistency in what's being sorted. Will there always be just one attribute?
  18. SLW210

    Need better multiline

    There are several LISPs and programs around for cable trays. @Tharwat has a program. Cable tray program | Tharwat Al Choufi Here's a thread on T-Connections... Draw cable tray T connection - AutoLISP, Visual LISP & DCL - AutoCAD Forums
  19. No time for me to look at your blocks, but have you looked into constraints? I have some dynamic block with lots of actions and even constrained if you do things in a weird order they can get a little off. So make sure length is set before the flip action. Probably could constrain them more or different. I don't know. I'll see what time I have today, but I am at work for a shorter time today than usual.
  20. well I hoped for this lisp to work with any blocks with attributes. here are the same b locks Im using. example [2].dwg
  21. AutoCAD gets strange sometimes when objects get far away from 0,0,0. That's all I can come up with.
  22. TCOUNT Express Tool. There used to be quite a few LISPs and Programs around to do that, you'll need to find one that suits your needs best. I use Lee Mac's from time to time. AutoCAD Mechanical has Balloon which works with a BOM and all sorts of options.
  23. My code only gives that error if there are letters in the ATTRIBUTE, works no errors on the drawing you posted. Maybe you should post an actual drawing that you are using this on. Even the images you posted are different by a lot from the drawing you posted.
  24. Is this what you're looking for ? DynBlock101_modified.dwg
  25. @devitgcode acts weird. It asks me to type distance,and when I do it places only one block and asks for distance again to pace another block, and on and on.
  26. This is a good video that explains lisp and how to do autocount block
  27. You may consider using this tool, which enables viewport panning with a customizable layer interface, retains coordinate memory, and functions even when the viewport is locked. I hope this helps you: https://lispautocad.gumroad.com/l/bgesj
  1. Load more activity
×
×
  • Create New...