Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/22/2022 in all areas

  1. @mhupp Thanks!!! (Again... ) What I did not realized is that i can use this: (8 . "MAINLINE_PIPES,ZONE_PIPES,Circular sectors,SPRAYLINES") and the "," is like OR condition. I've made a small change to the code, deleteing the OR condition of the colors since they appear in the list and the loop compare the original color and assign the lines to the new layer that have the color and the line width according to the condition in the list. here is the relevant code segment that I've changed a little (the actual datalist contains about 35 layers so I obviously didn't copied all of them...) : (if (setq ss (ssget "_X" '((0 . "LINE") (8 . "MAINLINE_PIPES,ZONE_PIPES,Circular sectors,SPRAYLINES")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq eData (mapcar '(lambda (d) (cdr (assoc d (entget ent)))) '(62 10 11))) (entdel ent) (setq f (assoc (car edata) Datalist)) (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 2) '(70 . 0) (cons 8 (cadr f)) (cons 43 (caddr f)) (cons 10 (cadr eData)) (cons 10 (caddr eData)) ) ) ) ) I've attached the full lisp here as a file. Thanks Again, Ari. test3.lsp
    1 point
  2. The sections of ssget that are strings you can just use , to select multiples instead of (-4 . "<or"). simplified the color filter by removing the mapcar since its short list. Also used the foreach method instead of using i (defun c:test (/ Datalist ss ent eData f) (setvar 'CECOLOR "BYLAYER") (setq Datalist '((6 "P_DN50-6" 0.15)(22 "P_DN32-6" 0.05)(54 "P_DN25-4" 0.05)(94 "P_DN40-6" 0.10)(214 "P_DN50-10" 0.15))) (if (setq ss (ssget "_X" '((0 . "LINE") (8 . "MAINLINE_PIPES,ZONE_PIPES,Circular sectors,SPRAYLINES") (-4 . "<or") (62 . 6) (62 . 22) (62 . 54) (62 . 94) (62 . 214) (-4 . "or>")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq eData (mapcar '(lambda (d) (cdr (assoc d (entget ent)))) '(62 10 11))) (entdel ent) (setq f (assoc (car edata) Datalist)) (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 2) '(70 . 0) (cons 8 (cadr f)) (cons 43 (caddr f)) (cons 10 (cadr eData)) (cons 10 (caddr eData)) ) ) ) ) (princ) )
    1 point
  3. Rectangles and Polylines can only be drawn in the XY plane. If you want to create these elements in the Front view you will need to rotate your UCS. Type UCS at the command prompt and hit Enter. Look at the command line to see your options. If you type X and hit Enter, then type 90 and hit Enter, your UCS will rotate 90 degrees around the X axis and you will then be able to draw Polylines and Rectangles in the Front view. Take a look at the link below to learn more about the UCS command. https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-Core/files/GUID-0BE49DA1-B323-4758-B49B-4C497D194C7A-htm.html
    1 point
  4. Try This (defun Circle (cen rad) (entmakex (list (cons 0 "CIRCLE") (cons 10 cen) (cons 40 rad) (cons 8 "Dot") ) ) ) (defun c:dot ( / e g f) (command "_.Layer" "_Make" "Dot" "_Color" "1" "" "LType" "Continuous" "" "") (setq e (entsel "\nPlease choose an object: ")) (setq e (entget (car e))) (foreach f e (if (= (car f) 10) (progn (setq g (list (cadr f) (caddr f))) (setq g (trans g 0 1)) (Circle g 0.5) (command "_-hatch" "_S" "_L" "" "_LA" "Dot" "_P" "_S" "") ) ) ) )
    1 point
×
×
  • Create New...