Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/05/2020 in all areas

  1. BricsCAD has these functions. But not using command calls would require a lot more code and be more challenging. But if you feel up to creating such a version: just go for it!
    1 point
  2. I don't see where a mouse driver is being loaded. For example... LH C:\MOUSE\MOUSE.EXE Or... LH C:\MOUSE\MOUSE.COM
    1 point
  3. Consider the following code & comments: (defun c:pk ( / z ) ;; Define function, declare local variables ;; Prompt the user to specify an elevation. ;; Use 'getreal' to ensure a numerical value is obtained. (if ;; If the following returns a non-nil value (setq z (getreal "\nSpecify elevation: ")) (sssetfirst ;; Highlight the following selection set nil ;; This argument was never properly implemented (ssget ;; Attempt to obtain a selection set "_X" ;; Search entire database (list ;; Construct the following filter list '(0 . "LWPOLYLINE") ;; Entity type '(-4 . ">=") ;; For some tolerance (cons 38 (- z 1e-3)) ;; Elevation lower bound '(-4 . "<=") ;; For some tolerance (cons 38 (+ z 1e-3)) ;; Elevation upper bound ) ;; end list ) ;; end ssget ) ;; end sssetfirst ;; Else the user dismissed the prompt: (princ "\nUser cancelled.") ) ;; end if (princ) ;; Return a null symbol to the command-line ) ;; end defun
    1 point
  4. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/request-for-custom-lisp-routine/td-p/9229798
    1 point
  5. 1 point
  6. Measure to the actual framing members using real dimensions for plans. Finish materials are noted and dimensioned in the sections and detail views. Framing crews will love you for it.
    1 point
  7. Try this solution: (defun KGA_Conv_EnameList_To_Pickset (lst / ret) (setq ret (ssadd)) (foreach enm lst (if (not (vlax-erased-p enm)) (ssadd enm ret))) (if (/= 0 (sslength ret)) ret) ) (defun KGA_Data_FileRead (fnm / lst ptr str) (if (setq ptr (open fnm "r")) (progn (while (setq str (read-line ptr)) (setq lst (cons str lst)) ) (close ptr) (reverse lst) ) ) ) (defun KGA_List_LastRemove (lst) (reverse (cdr (reverse lst))) ) ; Every record in the CSV has to have 3 or 4 numerical fields: X,Y,Z[,Radius]. (defun CsvToSweep_ReadCsv (fnm) (mapcar (lambda (str / lst) (setq lst (read (strcat "(" (vl-string-translate "," " " str) ")"))) (cond ((= 4 (length lst)) lst ) ((= 3 (length lst)) (append lst '(0.0)) ; Add default radius. ) ) ) (KGA_Data_FileRead fnm) ) ) ; Return value: List of line and arc objects. (defun CsvToSweep_CreatePath (spc datLst / linLst oldFilletrad ret) (setq oldFilletrad (getvar 'filletrad)) (setq linLst (mapcar '(lambda (subA subB) (vla-addline spc (vlax-3d-point (KGA_List_LastRemove subA)) (vlax-3d-point (KGA_List_LastRemove subB))) ) datLst (cdr datLst) ) ) (setq ret (cons (car linLst) (apply 'append (mapcar '(lambda (linA linB rad / enm) (setq enm (entlast)) (setvar 'filletrad rad) (command "_.fillet" (vlax-vla-object->ename linA) (vlax-vla-object->ename linB)) (if (not (equal enm (entlast))) (list (vlax-ename->vla-object (entlast)) linB) (list linB) ) ) linLst (cdr linLst) (mapcar 'cadddr (cdr datLst)) ) ) ) ) (setvar 'filletrad oldFilletrad) ret ) (defun CsvToSweep_CreateSolid (spc pathLst rad / lst oldDelobj prof) (setq oldDelobj (getvar 'delobj)) (setvar 'delobj 0) (setq prof (vlax-vla-object->ename (vla-addcircle spc (vlax-3d-point 0.0 0.0 0.0) rad))) (setq lst (vl-remove nil (mapcar '(lambda (path / enm) (setq enm (entlast)) (command "_.sweep" prof "" (vlax-vla-object->ename path)) (if (not (equal enm (entlast))) (entlast) ) ) pathLst ) ) ) (command "_.union" (KGA_Conv_EnameList_To_Pickset lst) "") (entdel prof) (setvar 'delobj oldDelobj) ) (defun c:CsvToSweep ( / datLst diam doc fnm pathLst spc) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (setvar 'cmdecho 0) (if (and (setq fnm (getfiled "Select CSV file" "" "csv" 4)) (setq datLst (CsvToSweep_ReadCsv fnm)) (or (not (vl-position nil datLst)) (prompt "\nError: invalid data ") ) (setq diam (getdist "\nDiameter: ")) ) (progn (setq spc ((if (= 1 (getvar 'cvport)) vla-get-paperspace vla-get-modelspace) doc)) (setq pathLst (CsvToSweep_CreatePath spc datLst)) (CsvToSweep_CreateSolid spc pathLst (/ diam 2.0)) (mapcar 'vla-delete pathLst) ) ) (setvar 'cmdecho 1) (vla-endundomark doc) (princ) )
    1 point
×
×
  • Create New...