Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/13/2025 in all areas

  1. Join worked with selection sets or it did in BricsCAD, but They have to be touching. quick googling you have to use the first entity in the selection set to "continue the command" then call the selection set. (command "_.join" (ssname sset1 0) "_J" sset1 "_Y") Use entmake way instead its much cleaner. -Edit Might want to make the rise and tread dynamic (defun C:FOO (/ SPT EPT RPT TPT ptlst) (setq SPT (getpoint "\nEnter Start Point: ") EPT (getpoint "\nEnter Top of First Stair: ") RoR (mapcar '- SPT EPT) ;Rise over Run from SPT to EPT R1 (polar SPT 0 (cadr RoR))) ptlst (append ptlst (list SPT R1)) ) (repeat 6 (setq RPT (polar r1 (* pi 0.5) (car RoR))) (setq TPT (polar r1 0 (cadr RoR))) (setq ptlst (append ptlst (list RPT TPT))) (setq RPT TPT) )
    2 points
  2. Quick testing, join wants individual entities and not a selection set: use (ssname sset1 0) (ssname sset1 1)... instead of sset1 Alternative would be record all the points in a list and entmake the polyline using these points or (command pline.... ) with all the points for all the stair EDIT: Following your code, this uses the entmake method: (defun c:test ( / s1 points r1 t1 newpoly) (setq t1 (getpoint "\nEnter first insertion point: ")) ; Get insertion point (setq points (list t1)) ; Create a list of points (repeat 6 ; repeat n times (6) (setq r1 (polar t1 (* pi 0.5) 0.15)) ; riser calculation (setq t1 (polar r1 0 0.3)) ; tread calculation (setq points (append points (list r1))) ; add riser point to list of points (setq points (append points (list t1))) ; add tread point to list of points ) (setq newpoly (entmakex (append (list ; create a polyline from list of points (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length points)) (cons 70 0)) (mapcar (function (lambda (p) (cons 10 p))) points)) )) ; end setq, end entmakex (princ) ; exit quietly )
    2 points
  3. Tharwat's program has an error handler that should reset the object snap modes and other settings. I don't know what you are doing to lose them. I suggest testing by setting explicit object snaps, then cancelling the program to see what changed. I also recommend that you don't use escape to exit a program, but enter out of it in a normal manner.
    1 point
  4. In the following link you can find all my HVAC programs on my website. NOTE: Trial versions are old now but latest versions are advanced and dynamic ones. https://autolispprograms.wordpress.com/hvac/
    1 point
  5. Latest version of that LISP is here
    1 point
  6. I have moved your thread to the AutoLISP, Visual LISP & DCL Forum.
    1 point
  7. @Hsanon Here is a version that lets you select certain blocks to update: (defun c:foo (/ e file o out x) ;; RJP » 2025-02-13 (vlax-for x (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (or (wcmatch (strcase (vla-get-name x)) "*|*") (setq out (cons (vla-get-name x) out))) ) (setvar 'cmdecho 0) (initget "All Pick") (if (eq (cond ((getkword (strcat "\nUpdate blocks [All/Pick] <All>: "))) ("All") ) "All" ) (foreach x out (if (setq file (findfile (strcat x ".dwg"))) (progn (command ".-INSERT" (strcat x "=" file) nil) (and (ssget "_X" (list '(0 . "insert") (cons 2 x) '(66 . 1))) (command "._attsync" "name" x) ) ) ) ) (while (and (setq e (car (entsel "\nSelect block to update: "))) (vlax-property-available-p (setq o (vlax-ename->vla-object e)) 'effectivename) (setq x (vlax-get o 'effectivename)) (setq file (findfile (strcat x ".dwg"))) ) (command ".-INSERT" (strcat x "=" file) nil) (and (ssget "_X" (list '(0 . "insert") (cons 2 x) '(66 . 1))) (command "._attsync" "name" x)) ) ) (setvar 'cmdecho 1) (princ) )
    1 point
  8. Thanks Pkenewell, Yep i'm a nob I'm new to all this so learning bits as i go sorry. I tested and it works great. This will save me heaps of time and i really appreciate it. Regards
    1 point
  9. Modified for 'dimaligned' and 'dimlinear'. Give it a go. I haven't tested it thoroughly. Do it for me (defun c:agrupaDIMs (/ n conj ent lstent pt pt1 pt2 ptIni ptFin desplz desplzX desplzY punto tamTX gapTX desplzMax osmant ang ptTx1 ptTx2 params escala rotDIM ) (setq n 0 osmant (getvar "OSMODE") ) (setvar "OSMODE" 0) (if (setq conj (ssget '((0 . "DIMEN*")))) (progn (while (setq ent (ssname conj n)) (setq pt1 (cdr (assoc 13 (setq lstent (entget ent)))) pt2 (cdr (assoc 14 lstent)) ptTx1 (cdr (assoc 10 lstent)) ptTx2 (if (setq rotDIM (= (cdr (last lstent)) "AcDbRotatedDimension")) (if (< (abs (- (cadr pt2) (cadr ptTx1))) 0.0001) (list (car ptTx1) (cadr pt1));o sea, acotación tumbada (list (car pt1) (cadr ptTx1));o sea, acotación levantada de arriba abajo o viceversa ) (polar pt1 (angle pt2 ptTx1) (distance pt2 ptTx1)) ) ang (angle pt2 (cdr (assoc 10 lstent))) tamTX (vlax-get-property (vlax-ename->vla-object ent) "TextHeight" ) gapTX (vlax-get-property (vlax-ename->vla-object ent) "TextGap" ) escala (vlax-get-property (vlax-ename->vla-object ent) "ScaleFactor" ) desplz (+ (* tamTX escala) gapTX) ) (if (not params) (setq params (list tamTX (vlax-get-property (vlax-ename->vla-object ent) 'ArrowheadSize))) ) (if desplzMax (setq desplzMax (max desplzMax desplz)) (setq desplzMax desplz) ) (if (< (car ptTx2) (car ptTx1)) (setq pt ptTx1 ptTx1 ptTx2 ptTx2 pt ) (if (= (car ptTx2) (car ptTx1)) (if (< (cadr ptTx2) (cadr ptTx1)) (setq pt ptTx1 ptTx1 ptTx2 ptTx2 pt ) ) ) ) (if ptIni (if (and (/= (car ptTx2) (car ptTx1)) (< (car ptTx1) (car ptIni)) ) (setq ptIni ptTx1) (if (= (car ptTx1) (car ptTx2)) (if (< (cadr ptTx1) (cadr ptIni)) (setq ptIni ptTx1) ) ) ) (setq ptIni ptTx1) ) (if ptFin (if (and (/= (car ptTx2) (car ptTx1)) (> (car ptTx2) (car ptFin)) ) (setq ptFin ptTx2) (if (= (car ptTx2) (car ptTx2)) (if (> (cadr ptTx2) (cadr ptFin)) (setq ptFin ptTx2) ) ) ) (setq ptFin ptTx2) ) (setq n (+ n 1)) ) (setq punto (polar ptIni (angle ptIni ptFin) (/ (distance ptIni ptFin) 2.0) ) punto (polar punto ang (* desplzMax 2.0)) ) (if rotDIM (vl-cmdf "_dimlinear" ptIni ptFin punto) (vl-cmdf "_dimaligned" ptIni ptFin punto) ) (vlax-put-property (vlax-ename->vla-object (entlast)) 'TextHeight (* (car params) escala)) (vlax-put-property (vlax-ename->vla-object (entlast)) 'ArrowheadSize (* (cadr params) escala)) (setvar "OSMODE" osmant) ) ) (princ) )
    1 point
  10. u can also try TEXTMASK, masktype 3dsolid and when all text selected in properties u set edges to visible
    1 point
×
×
  • Create New...