Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/21/2023 in all areas

  1. Hello friends, Running a forum like this often feels like a long-running battle against those who would like to deface or destroy what we do here. From time-to-time we need to change the way we operate to stay one step ahead of the hackers and haters. From today, the way you login to this forum will change. Historically, you've been able to login using your screen name and password. The problem with this approach is that your screen name is publicly available, so all a hacker has to do is to find your password. From today, you will not be able to login using your screen name, you will need to use the email address associated with your account. Since your email address is not publicly available, this change presents a significant defense against hackers. If you already login using your email address, you do not need to change the way you login. We recommend that you always use a strong password to avoid your account being hacked.
    1 point
  2. Here is an example that I posted in this forum a few hours ago.
    1 point
  3. What this code does: - Lines are no problem. Everywhere the Z value is set to 0 - Arc: Arcs have a center; I set its z-value to 0 - Polyline: they have an elevation, just a number. I set it to 0. Things like polylines, circles, arcs... are always drawn on a UCS plane. If that plane is not parallel to the current plane, then this code will not do what you want. I don't touch anything else, like blocks, 3D polyline, ... Just what you asked. Command FLAT (feel free to rename) (defun c:flat ( / ss i ent ip1 ip2 elv) ;; lines (setq ss (ssget "_X" (list (cons 0 "LINE")))) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; insert point start (setq ip1 (cdr (assoc 10 (entget ent)))) ;; add a z-value 0.0 , or replace the z-value by 0.0 (setq ip1 (list (nth 0 ip1) (nth 1 ip1) 0.0 )) ;; insert point start (setq ip2 (cdr (assoc 11 (entget ent)))) ;; add a z-value 0.0 , or replace the z-value by 0.0 (setq ip2 (list (nth 0 ip2) (nth 1 ip2) 0.0 )) ;; entity modify, by substituting groups (entmod (subst (cons 10 ip1) (assoc 10 (entget ent)) (entget ent) )) ;; substitute IP start (entmod (subst (cons 11 ip2) (assoc 11 (entget ent)) (entget ent) )) ;; substitute IP end (setq i (+ i 1)) ) ;; ARC (setq ss (ssget "_X" (list (cons 0 "ARC")))) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; insert point center (setq ip1 (cdr (assoc 10 (entget ent)))) ;; add a z-value 0.0 , or replace the z-value by 0.0 (setq ip1 (list (nth 0 ip1) (nth 1 ip1) 0.0 )) (entmod (subst (cons 10 ip1) (assoc 10 (entget ent)) (entget ent) )) ;; substitute IP center (setq i (+ i 1)) ) ;; POLYLINE (setq ss (ssget "_X" (list (cons 0 "LWPOLYLINE")))) (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) ;; Elevation (setq elv 0.0) (entmod (subst (cons 38 elv) (assoc 38 (entget ent)) (entget ent) )) ;; substitute elevation (setq i (+ i 1)) ) )
    1 point
  4. You can read a selection from excel and then make a table of that info, just not sure how you would do that to inside a block, as a separate table yes can do. Direct read from excel using lisp.
    1 point
  5. Here is a link to the best break symbol tool that I know of - and it's free: http://www.theswamp.org/index.php?topic=37531.0
    1 point
  6. I don't know will it work or not, but I've changed it - little more obvious... Malformed error occur if you don't have brackets open/closed at right places... Please use code tags next time you post a code... (defun c:PlaceBlock ( / blkname pt ss x y dist layers selLayer selBlock blkList ) (setq blkList '("SELECT BLOCK" "DIN_A3" "DIN_A4" "DIN_A5" "DIN_A6" "DIN_A7")) ; current bloks (setq layers (append '("SELECT LAYER") (vl-sort (acad_active_document_layers) '<))) ; current layers (setq selBlock "SELECT BLOCK") (setq selLayer "SELECT LAYER") (setq blkname (car (member (setq selBlock (cond ((findfile (strcat (getvar "dwgprefix") "blocks\\" (strcat selBlock ".dwg"))) selBlock) (t (getstring "\nEnter block name: ")))) blkList ) ) ) (setq selLayer (cdr (assoc (get_tile "layerList") layers))) (prompt "\nPick block to make diagonal array...") (setq ss (ssget "+._:E:S" (list (cons 0 "INSERT")))) (setq x (getreal "\nEnter x distance between blocks: ")) (setq y (getreal "\nEnter y distance between blocks: ")) (setq dist (getint "\nEnter number of blocks to place: ")) (setq pt (cdr (assoc 10 (entget (ssname ss 0))))) (if (and blkname selLayer) (progn (command "_.undo" "_begin") (repeat dist (command "_.insert" blkname ss "" "_non" pt "" "" (strcat "LAYER" selLayer)) (setq pt (mapcar '+ (list x y 0) pt)) ) (command "_.undo" "_end") ) ) (princ) ) (defun acad_active_document_layers ( / layname laynames ) (while (tblnext "LAYER" (not layname)) (setq laynames (cons layname laynames)) ) laynames ) (defun get_tile (tile) (cdr (assoc tile (acet-ui-dialog-show "LISP Place Block" '((layerList ("Layer:" . "SELECT LAYER")) (blockList ("Block:" . "SELECT BLOCK")) ) '((ok-button . true) (cancel-button . true) (title . "Place Block")) ))) ) This is for rectangular array (if it works)... (defun c:PlaceBlock ( / blkname pt ss x y dist layers selLayer selBlock blkList ) (setq blkList '("SELECT BLOCK" "DIN_A3" "DIN_A4" "DIN_A5" "DIN_A6" "DIN_A7")) ; current bloks (setq layers (append '("SELECT LAYER") (vl-sort (acad_active_document_layers) '<))) ; current layers (setq selBlock "SELECT BLOCK") (setq selLayer "SELECT LAYER") (setq blkname (car (member (setq selBlock (cond ((findfile (strcat (getvar "dwgprefix") "blocks\\" (strcat selBlock ".dwg"))) selBlock) (t (getstring "\nEnter block name: ")))) blkList ) ) ) (setq selLayer (cdr (assoc (get_tile "layerList") layers))) (prompt "\nPick block to make rectangular array...") (setq ss (ssget "+._:E:S" (list (cons 0 "INSERT")))) (setq x (getreal "\nEnter x distance between blocks: ")) (setq y (getreal "\nEnter y distance between blocks: ")) (setq dist (getint "\nEnter number of blocks to place: ")) (setq pt (cdr (assoc 10 (entget (ssname ss 0))))) (if (and blkname selLayer) (progn (command "_.undo" "_begin") (repeat dist (repeat dist (command "_.insert" blkname ss "" "_non" pt "" "" (strcat "LAYER" selLayer)) (setq pt (mapcar '+ (list x 0 0) pt)) ) (setq pt (mapcar '+ (list (- (* dist x)) y 0) pt)) ) (command "_.undo" "_end") ) ) (princ) ) (defun acad_active_document_layers ( / layname laynames ) (while (tblnext "LAYER" (not layname)) (setq laynames (cons layname laynames)) ) laynames ) (defun get_tile (tile) (cdr (assoc tile (acet-ui-dialog-show "LISP Place Block" '((layerList ("Layer:" . "SELECT LAYER")) (blockList ("Block:" . "SELECT BLOCK")) ) '((ok-button . true) (cancel-button . true) (title . "Place Block")) ))) )
    1 point
  7. Just get a copy of Steal.lsp from www.Lee-mac.com does more than layers, can be command line driven so no user interaction, use (if (not steal)(load "StealV1-8)) to demand load the program a simple 1 line in your code.
    1 point
×
×
  • Create New...