Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/26/2019 in all areas

  1. Right, I actually overlooked the red texts in the image... So the request makes more sense now. Try the code below. Change the value of *idxLyrNme* to your liking. (setq *idxLyrNme* "Dim_Index_Layer") (vl-load-com) (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_FileWrite (fnm lst / ptr) (if (setq ptr (open fnm "w")) (progn (write-line (KGA_String_Join lst "\n") ptr) (close ptr) T ) ) ) (defun KGA_String_Join (strLst delim) (if strLst (apply 'strcat (cons (car strLst) (mapcar '(lambda (a) (strcat delim a)) (cdr strLst)) ) ) "" ) ) (defun KGA_Sys_ObjectOwner (obj) (vla-objectidtoobject (vla-get-database obj) (vla-get-ownerid obj)) ) ; WCS must be active for this function. ; The text position for diametric and radial dimensions is on the dim line. ; Index mtexts will be closer to the dim text for these dimensions. (defun DimToCsv_CreateIdxMtext (dim ang idx / mtxt) ; Dim is dimension object. (setq mtxt (vla-addmtext (KGA_Sys_ObjectOwner dim) (vlax-3d-point '(0.0 0.0 0.0)) 0.0 (itoa idx) ) ) (vlax-put mtxt 'normal (vlax-get dim 'normal)) (vlax-put mtxt 'insertionpoint (mapcar '+ (vlax-get dim 'textposition) (trans (polar '(0.0 0.0 0.0) (+ (/ pi 2.0) ang) (* 2.0 (vla-get-textheight dim)) ) (vlax-get dim 'normal) 0 T ) ) ) (vlax-put mtxt 'rotation ang) (vla-put-attachmentpoint mtxt 5) (vla-put-height mtxt (* 0.75 (vla-get-textheight dim))) (vla-put-layer mtxt *idxLyrNme*) mtxt ) (defun DimToCsv_GetDimMtext (def / ret) (vlax-for obj def (if (and (not ret) (= "AcDbMText" (vla-get-objectname obj)) ) (setq ret obj) ) ) ret ) (defun DimToCsv_UnformatStr (str) ; Very limited. (vl-string-subst "°" "%%d" (vl-string-subst "Ø" "%%c" str)) ) (defun DimToCsv_WriteCsv (fnm lst) (KGA_Data_FileWrite fnm (mapcar '(lambda (sub) (KGA_String_Join sub ",")) lst) ) ) (defun c:DimToCsv ( / blks doc fnm idx lst ss) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (and (or (= 1 (getvar 'worlducs)) (prompt "\nError: the current UCS is not the WCS ") ) (setq ss (ssget '((0 . "DIMENSION")))) (setq fnm (getfiled "CSV file" (getvar 'dwgprefix) "csv" 5)) ) (progn (vla-add (vla-get-layers doc) *idxLyrNme*) (setq blks (vla-get-blocks doc)) (setq idx 0) (setq lst (vl-remove nil (mapcar '(lambda (enm / mtxt) (if (setq mtxt (DimToCsv_GetDimMtext (vla-item blks (cdr (assoc 2 (entget enm)))))) (progn (setq idx (1+ idx)) (DimToCsv_CreateIdxMtext (vlax-ename->vla-object enm) (vla-get-rotation mtxt) idx) (list (itoa idx) (strcat "\"" (DimToCsv_UnformatStr (vla-get-textstring mtxt)) "\"")) ) ) ) (KGA_Conv_Pickset_To_EnameList ss) ) ) ) (DimToCsv_WriteCsv fnm (cons '("\"NO.\"" "\"TEXT\"") lst)) ) ) (vla-endundomark doc) (princ) )
    2 points
  2. Perhaps this link to AutoCAD Knowledge Network may explain your problem.
    1 point
  3. ok work with cel weight ! thanks to all!
    1 point
  4. Did you try DIM BASE Must have 1 dim existing, dim style needed as well.
    1 point
  5. You can use Lee's list box.lsp to make a list of the layers so you can pick the layer from a list. Some one has probably done this did you goggle.
    1 point
×
×
  • Create New...