Jump to content

Leaderboard

Popular Content

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

  1. Good Morning. I opened your drawing using Draftsight and then I exploded it. The result was one rectangle and ten oblong slots (i.e. - screw holes). Every object is on layer "0" with a layer color of "white". I have attached a copy of the drawing below. It has been saved in AutoCAD 2013 .dwg file format. Basic Rack.dwg
    1 point
  2. My $0.05, note no check if when doing ssget that you pick original text as well. Used strcat rather than change better way to go (defun c:jtxt ( / ss obj toch tnew obj obj2) (command "style" "rs" "romans" "2.2" "0.8" "" "" "" "") (setq obj (vlax-ename->vla-object (car (entsel "\nPick text to change: ")))) (setq toch (vla-get-textstring obj)) (setq ss (ssget (list (cons 0 "text")))) (setq x -1) ; ss starts at 0 (repeat (sslength ss) (setq obj2 (vlax-ename->vla-object (ssname ss (setq x (+ x 1))))) (setq tnew (vla-get-textstring obj2)) (setq toch (strcat toch " " tnew)) (vla-delete obj2) ) (vla-put-textstring obj toch) (vla-put-stylename obj "rs") (princ) )
    1 point
  3. Marko has identified the piece of code that causes the problem. The (= count slen) condition is true only once.
    1 point
  4. Have you tried to replace this : (while (= count slen) (entdel sget) (setq count (1- count)) ) With this : (acet-ss-entdel sset) Regards...
    1 point
  5. Updated version (below and attached). This version will miter corners without a bend. If the CSV contains no bend radius information the user is now prompted for a radius. Code tested on BricsCAD V18. (vl-load-com) (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_Conv_Pickset_To_EnameList (ss / i ret) (if ss (repeat (setq i (sslength ss)) (setq ret (cons (ssname ss (setq i (1- i))) 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) ) ) ) ; 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 ((not (vl-every 'numberp lst)) nil ) ((= 4 (length lst)) (list (list (car lst) (cadr lst) (caddr lst)) (cadddr lst)) ) ((= 3 (length lst)) (list lst) ) ) ) (KGA_Data_FileRead fnm) ) ) ; Return value: List of lines, (3D) polylines and arcs as enames. The enames are in a random order. (defun CsvToSweep_CreatePath (spc datLst userRad / linLst lst oldClayer oldFilletrad tmpLyr tmpLyrNme) ;; Create a temp layer for the path entities: (while (tblsearch "layer" (setq tmpLyrNme (strcat "CsvToSweep_" (rtos (getvar 'cdate) 2 8)))) ) (setq tmpLyr (vla-add (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) tmpLyrNme)) (setq oldClayer (getvar 'clayer)) (setvar 'clayer tmpLyrNme) ;; Create the lines: (setq linLst (mapcar '(lambda (subA subB) (vlax-vla-object->ename (vla-addline spc (vlax-3d-point (car subA)) (vlax-3d-point (car subB))) ) ) datLst (cdr datLst) ) ) ;; Create the arcs: (setq oldFilletrad (getvar 'filletrad)) (mapcar '(lambda (linA linB datRad / enm) (setvar 'filletrad (cond (datRad) (userRad) (0.0))) (command "_.fillet" linA linB) ) linLst (cdr linLst) (mapcar 'cadr (cdr datLst)) ) (setvar 'filletrad oldFilletrad) ;; Try to join the lines: (princ "\nTrying to join the lines in the path (will fail at bends): ") (command "_.join" (KGA_Conv_EnameList_To_Pickset linLst) "") ;; Cleanup and return value: (setq lst (KGA_Conv_Pickset_To_EnameList (ssget "_X" (list (cons 8 tmpLyrNme))))) (mapcar '(lambda (enm) (vla-put-layer (vlax-ename->vla-object enm) oldClayer)) lst ) (setvar 'clayer oldClayer) (vla-delete tmpLyr) lst ) (defun CsvToSweep_CreateSolid (spc pathLst rad / lst oldDelobj prof) (setq prof (vlax-vla-object->ename (vla-addcircle spc (vlax-3d-point 0.0 0.0 0.0) rad))) (setq oldDelobj (getvar 'delobj)) (setvar 'delobj 0) (setq lst (vl-remove nil (mapcar '(lambda (path / enm) (setq enm (entlast)) (command "_.sweep" prof "" path) (if (not (equal enm (entlast))) (entlast) ) ) pathLst ) ) ) (setvar 'delobj oldDelobj) (entdel prof) (if (< 1 (length lst)) (command "_.union" (KGA_Conv_EnameList_To_Pickset lst) "") ) (vl-remove-if 'vlax-erased-p lst) ) (defun c:CsvToSweep ( / bendRad datLst profDiam 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 ") ) (or (not (vl-every '(lambda (sub) (= 1 (length sub))) datLst)) (setq bendRad (getdist "\nBend radius: ")) ) (setq profDiam (getdist "\nProfile diameter: ")) ) (progn (setq spc ((if (= 1 (getvar 'cvport)) vla-get-paperspace vla-get-modelspace) doc)) (setq pathLst (CsvToSweep_CreatePath spc datLst bendRad)) (if (= 1 (length (CsvToSweep_CreateSolid spc pathLst (/ profDiam 2.0)))) (princ "\nSweep successfully created ") (princ "\nAn unxpected error occured ") ) (mapcar 'entdel pathLst) ) ) (setvar 'cmdecho 1) (vla-endundomark doc) (princ) ) CsvToSweep_20200104.zip
    1 point
  6. Go to Options > Display > Layout Elements > Display Layout and Model tabs.
    1 point
×
×
  • Create New...