Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/06/2023 in all areas

  1. No codes needed, just use the native command name: QDIM then selected the target curve objects.
    1 point
  2. Which suggestions have you tried? What about this "Undefined Shape [XX]" when opening a drawing in AutoCAD (autodesk.com)?
    1 point
  3. 1 point
  4. like to convert everything into vla-object from the selection set by using the foreach and "(mapcar 'vlax-ename->vla-object" (defun c:evp2 (/ ssvp sc vlag) (if (setq ssvp (ssget "X" '((0 . "VIEWPORT")))) (foreach obj (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex sssvp))) (setq sc (vlax-get obj 'customscale)) (cond ((equal sc 1.0 1e-03)(setq vlag 0)) ((equal sc 10.0 1e-03)(setq vlag 0)) ((equal sc 5.0 1e-03)(setq vlag 0)) ((equal sc 50.0 1e-03)(setq vlag 0)) ((setq vlag 1)) ) (if (= vlag 1) (progn (vlax-put obj 'color 1) (prompt "\nViewport has wrong scale!") ;will process all viewports and not stop waiting for user to click ok (setq vlag nil) ) ) ) (alert "NO viewports selected \n \nWill exit now") ) (princ) ) If it displays your View ports have errors should probably have a lisp to go to the tab with the error. ;;------------------------------------------------------------------;; ;; Fine View port (defun c:FVP (/ ssvp) (if (setq ssvp (ssget "X" '((0 . "VIEWPORT") (62 . 1)))) (progn (setvar 'ctab (cdr (assoc 410 (entget (ssname ssvp 0))))) ;go to tab with the first viewport found (prompt (starcat "\n" (rtos (sslength ssvp) 2 0) "Viewports need to be Checked")) ) (prompt "\nDidn't fine any Viewports with error's") ) (princ) ) updated code
    1 point
  5. My $0.05 Did you use chatGP for code ? (defun c:evp2 ( / ssvp tel sc vlag obj) (setq ssvp (ssget "X" '((0 . "VIEWPORT")))) (if (= ssvp nil)(progn (alert "NO viewports selected \n \nWill exit now ")(exit))) (repeat (setq tel (sslength ssvp)) (setq obj (vlax-ename->vla-object (ssname ssvp (setq tel (1- tel))))) (setq sc (vlax-get obj 'customscale)) (cond ((equal sc 1.0 1e-03)(setq vlag 0)) ((equal sc 10.0 1e-03)(setq vlag 0)) ((equal sc 5.0 1e-03)(setq vlag 0)) ((equal sc 50.0 1e-03)(setq vlag 0)) ((setq vlag 1)) ) (if (= vlag 1) (progn (vlax-put obj 'color 1) (alert "One or more viewports have got a wrong scale ! \n \nNow RED color ") (setq vlag nil) ) ) ) (princ) ) (c:evp2 )
    1 point
  6. If you make a lisp that does what you want but want to use in various routines, you are correct you can load that separate program on demand. So looking at this if the defun AH:Butts does not exists load external lisp program. Then run that defun. (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (setq bar (list "Please choose" "6" "8" "10" "12" "14" "16" "18" "20" "22" "25" "28" "32" "36" "40")) (setq barsz (atof (ah:butts 1 "v" bar))) Note the program is saved in a support path and trusted path for ACAD.
    1 point
  7. Since autolisp overwrites with the last defun, if there may or may not be arguments, it is recommended to receive arguments as a list as in the answer to the link, then check the list and process it with cond or if. or I don't know the detailed routine, but if there are multiple argument cases, like below. (defun c:mainroutine ( / ss ssl arg ) (defun subroutine1 ( / ) (princ "\n case 1 selected - 1 ea") ) (defun subroutine2 ( a / ) (princ "\n case 2 selected - ") (princ a) (princ " ea") ) (if (setq ss (ssget)) (progn (if (> (setq ssl (sslength ss)) 1) (setq arg 2) (setq arg 1) ) (cond ((= arg 1) (subroutine1) ) ((= arg 2) (subroutine2 ssl) ) ) ) ) (princ) ) However, if it is simply because of the bracket, rather than dividing defun like this, I think it would be better to create a separate routine according to the textstring using cond. in one main routine.
    1 point
×
×
  • Create New...