Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/29/2022 in all areas

  1. Here's another way to do it with very little error checking. (defun c:foo (/ n) (or (setq n (getint "\nEnter percent:<30>")) (setq n 30)) (foreach l '("TEST-PP-30%_Design_Review" "TEST-PP-60%_Design_Review" "TEST-PP-90%_Design_Review") (vl-catch-all-apply 'vla-put-freeze (list (vlax-ename->vla-object (tblobjname "layer" l)) (if (wcmatch l (strcat "*" (itoa n) "*")) 0 -1 ) ) ) ) (princ) )
    3 points
  2. http://docs.autodesk.com/ACAD_E/2012/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a62.htm (62 . 61) --edit put this in your command line (acad_colordlg 61)
    2 points
  3. Nice. You can get rid of some lines of code if your doing one item at a time. usually when I'm use this its with multi polyline, text, & other stuff. ;; DRAW RECTANGLE FROM USER SELECTION (defun c:REC (/ SS ent ptslst LL UR L&W l w MPT) (vl-load-com) (if (setq SS (ssget)) (progn (command "_.view" "_save" "back") ;save zoom location (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt) (setq LL (vlax-safearray->list minpt) ;could use this as point for rectangle no need to zoom? UR (vlax-safearray->list maxpt) L&W (mapcar '- UR LL) ) (command "_zoom" "_object" (ssadd ent) "") (command "_zoom" "0.5x") (redraw ent 3) ;always nice to see whats currently being calculated (setq LL (getpoint "Select Lower Left Corner Position")) (command "_.view" "_restore" "back") ;zoom back to save spot (if (setq l (getdist (strcat "\nRectangle Length [" (rtos (car L&W) 2 3) "]: "))) (progn) (setq l (car L&W)) ) (if (setq w (getdist (strcat "\nRectangle Width [" (rtos (cadr L&W) 2 3) "]: "))) (progn) (setq w (cadr L&W)) ) (setvar 'cmdecho 0) (vl-cmdf "_.Rectangle" "_non" LL "_non" (strcat "@" (rtos l 2 4) "," (rtos w 2 4))) (setvar 'cmdecho 1) (entdel ent) ) ;end for each ) ;end progn ;(vl-cmdf "_.Rectangle") ;prob don't want this if nothing is selected ) ;end if (princ) )
    1 point
  4. Just made a couple of quick changes, selecting the rectangles one at a time - didn't quite work for me doing them as a group but will fix that later. Added zooming to and highlighting the rectangle in question, selecting a point for its lower left corner (rather then using its centre point for position) then resize. Good enough to save me an hour today, and one to come back to later (vl-load-com) ;; DRAW RECTANGLE FROM USER SELECTION (defun c:REC (/ SS ent ptslst LL UR L&W l w MPT) (if (setq SS (ssget)) (progn (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt) (setq ptslst (cons (vlax-safearray->list minpt) ptslst) ptslst (cons (vlax-safearray->list maxpt) ptslst) ) ; ) ;end for each (command "_zoom" "_object" (ssadd ent) "") (command "_zoom" "0.5x") (redraw ent 3) (setq MPT (getpoint "Select Lower Left Corner Position")) (command "zoom" "p");;Zoom previous (command "zoom" "p");;Zoom previous (setq LL (apply 'mapcar (cons 'min ptslst)) UR (apply 'mapcar (cons 'max ptslst)) ;; MPT (mapcar '/ (mapcar '+ LL UR) '(2 2 2)) L&W (mapcar '- UR LL) ) (if (setq l (getdist (strcat "\nRectangle Length [" (rtos (car L&W) 2 3) "]: "))) (progn) (setq l (car L&W)) ) (if (setq w (getdist (strcat "\nRectangle Width [" (rtos (cadr L&W) 2 3) "]: "))) (progn) (setq w (cadr L&W)) ) ;; (setq MPT (list (- (car MPT) (/ l 2)) (- (cadr MPT) (/ w 2)))) (setvar 'cmdecho 0) (vl-cmdf "_.Rectangle" "_non" MPT "_non" (strcat "@" (rtos l 2 4) "," (rtos w 2 4))) (setvar 'cmdecho 1) (entdel ent) ) ;end for each ) ;end progn (vl-cmdf "_.Rectangle") ) ;end if (princ) )
    1 point
  5. Your lisp code appears to be missing a " before LOT 50" and has too many closing parenthesis ).
    1 point
  6. I'll share with you a poem that written by me if you know turkish let's read together Sözcüklerle reddetsende beni kendinden arkadamı dönüpte gidemiyorum ki senden zifiri karanlık gecelerde amansız hasretinden prangalar vurulur bana yüreğinden sürgünken . . .
    1 point
  7. I think we need a poem. but that might have more to do with bio fuel so i won't hold my breath.
    1 point
  8. That might work for todays problems. Thanks, (just checking, yes that will line up everything with a bit of user input and could be a god start to what I am after later)
    1 point
  9. Made this awhile back combines bounding box with rectangle command. What ever you select it will give you the rectangle length and width. but you can change the values to what you want. if you do the rectangle will be centered on what you selected. --edit added bounding box it instead of (BBox) Only really helpful for horizontal rectangles ;;----------------------------------------------------------------------------;; ;; DRAW RECTANGLE FROM USER SELECTION (defun C:REC (/ SS ent ptslst LL UR L&W l w MPT) (if (setq SS (ssget)) (progn (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt) (setq ptslst (cons (vlax-safearray->list minpt) ptslst) ptslst (cons (vlax-safearray->list maxpt) ptslst) ) ) (setq LL (apply 'mapcar (cons 'min ptslst)) UR (apply 'mapcar (cons 'max ptslst)) MPT (mapcar '/ (mapcar '+ LL UR) '(2 2 2)) L&W (mapcar '- UR LL) ) (if (setq l (getdist (strcat "\nRectangle Length [" (rtos (car L&W) 2 3) "]: "))) (progn) (setq l (car L&W)) ) (if (setq w (getdist (strcat "\nRectangle Width [" (rtos (cadr L&W) 2 3) "]: "))) (progn) (setq w (cadr L&W)) ) (setq MPT (list (- (car MPT) (/ l 2)) (- (cadr MPT) (/ w 2)))) (setvar 'cmdecho 0) (vl-cmdf "_.Rectangle" "_non" MPT "_non" (strcat "@" (rtos l 2 4) "," (rtos w 2 4))) (setvar 'cmdecho 1) ) (vl-cmdf "_.Rectangle") ) (princ) )
    1 point
  10. In the past, I've seen how to use the change command and snap to correct a slightly distorted vertical horizontal line. It probably won't work for rectangles. If there are no arcs and curves in your drawing, It would be good to start by reading all polylines and lines, making their coordinates into a list, and circulating the list and bringing them to integer positions. But in this case, the rectangle is at 101.11x99.9999 Something like 101x100 will happen. it seems to need a fuzzy roundup value as 5 or 10.
    1 point
  11. How about the MATCHPROP command?
    1 point
×
×
  • Create New...