Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/26/2021 in all areas

  1. Nice .. FWIW if you create the circle like so it will retain all by object properties too: (defun c:el2cir (/ cen cnt en ent maj mad) (if (setq ss (ssget '((0 . "ELLIPSE")))) (repeat (setq cnt (sslength ss)) (setq ent (entget (setq en (ssname ss (setq cnt (1- cnt)))) '("*")) cen (cdr (assoc 10 ent)) maj (cdr (assoc 11 ent)) mad (distance '(0.0 0.0 0.0) maj) ) (if (= (cdr (assoc 40 ent)) 1.0) ;; (progn (command "._circle" "_non" cen mad) (entdel en)) (and (entmake (append '((0 . "CIRCLE")) (vl-remove-if '(lambda (x) (vl-position (car x) '(-1 0 100 330 5 11 40 41 42))) ent) (list (cons 40 mad)) ) ) (entdel en) ) ) ) ) (princ) )
    2 points
  2. It works like a charm! I really thank you @pkenewell and @ronjonp. Just in some cases it didn`t works but it was because Major to minor radius ratio was apparently diffetent of 1, so I just deleted the conditional and it works great.
    1 point
  3. Oh thanks! I was trying to solve the problem only by setting the variables and I didn't think about the Layer State! Thanks you solved the problem!
    1 point
  4. Here is a function to do it. Note - this only works if the Major to Minor radius ratio is 1 (in other words - looks like a circle). If you want it different then let me know. (defun C:EL2CIR (/ cen cnt en ent maj mad) (if (setq ss (ssget '((0 . "ELLIPSE")))) (repeat (setq cnt (sslength ss)) (setq ent (entget (setq en (ssname ss (setq cnt (1- cnt))))) cen (cdr (assoc 10 ent)) maj (cdr (assoc 11 ent)) mad (distance '(0.0 0.0 0.0) maj) ) (if (= (cdr (assoc 40 ent)) 1.0) (progn (command "._circle" "_non" cen mad) (entdel en) ) ) ) ) (princ) )
    1 point
  5. IMO, compiled code does nothing to help the community .. unless you came upon the magic algorithm to mine bitcoin and place it in your bank account from lisp, you should leave it uncompiled.
    1 point
  6. Here is a simple bit of code that will do it. (defun c:UnmirrorBlock (/ ss en xscl yscl zscl) (if (setq ss (ssget '((0 . "INSERT")))) (progn (repeat (setq cnt (sslength ss)) (setq en (entget (ssname ss (setq cnt (1- cnt)))) xscl (abs (cdr (assoc 41 en))) yscl (abs (cdr (assoc 42 en))) zscl (abs (cdr (assoc 43 en))) en (subst (cons 41 xscl) (assoc 41 en) en) en (subst (cons 42 yscl) (assoc 42 en) en) en (subst (cons 43 zscl) (assoc 43 en) en) en (subst (cons 50 0.0) (assoc 50 en) en) ) (entmod en) ) ) ) )
    1 point
  7. The reason is because it tries to run the other commands before you finish the "pline" command. You need to delay the operation of the rest of the routine until it is finished. It does not do this for you with only 1 PAUSE option. Try This - note the "cmdactive" loop to pause the "pline" command until you are finished drawing the polyline (see my comments for other improvements): (Defun C:TestPl (/ plccLayer oecho oplwid ss); Localize your variables (setq plccLayer (getvar "clayer") oplwid (getvar "plinewid") oecho (getvar "cmdecho")) (setvar "plinewid" 0.015) ;; Don't use command to set system variables. ;; You want CMDECHO set to 1 here so you can see pline prompts. ;; FYI - the "dot" before the command ensures that the true command is used (not redefined), ;; the "underscore" will translate command names and options for international versions. (COMMAND "._-LAYER" "_M" "FIBER" "_C" "130" "" "_L" "FENCELINE1" "" "" "._PLINE" ) ;; This loops the pause until the command is over. (while (= (logand (getvar "cmdactive") 1) 1) (command pause) ) ;; reset system variable back to original values. (setvar "clayer" plccLayer) (setvar "PLINEWID" oplwid) ;; Set cmdecho here to 0 to not see the change command. (setvar "CMDECHO" 0) (setq ss (ssget "L")) (command "._Change" ss "" "_P" "_S" 0.25 "") ;; Reset cmdecho back to original value. (setvar "cmdecho" oecho) (princ) )
    1 point
  8. if the TAG name is known you can use setpropertyvalue (defun c:NLENGTH (/ obj p1 di) (setq p1 (getpoint "\nPoint 1: ")) (setq di (getdist p1 "\nDistance: ")) (setq obj (car (entsel "\nSelect Block "))) (setpropertyvalue obj "QUANTITY" (rtos di)) (command "regen") (princ) )
    1 point
×
×
  • Create New...