XDSoft Posted April 23, 2024 Posted April 23, 2024 On 4/15/2024 at 9:21 PM, pkenewell said: I recommend that you also provide instructions on your GITHUB on how to download and install the ObjectARX Library properly. Maybe also start a "releases" section? I have made a compressed package version, no EXE is required, you can try it if you are interested. https://github.com/xdcad/XDrx-API-zip https://github.com/xdcad Quote
XDSoft Posted April 23, 2024 Posted April 23, 2024 On 4/17/2024 at 12:10 AM, Steven P said: Yes, welcome to the corporate world. I have made a compressed package version, no EXE is required, you can try it if you are interested. https://github.com/xdcad/XDrx-API-zip https://github.com/xdcad Quote
Nikon Posted January 29 Posted January 29 On 7/14/2022 at 1:54 AM, ronjonp said: And another that allows a pick of any part of the dimension (defun c:foo (/ e el m p1 p2) (if (and (setq e (car (entsel "\nPick dimension: "))) (progn (vlax-for a (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (cdr (assoc 2 (entget e))) ) (and (= "AcDbMText" (vla-get-objectname a)) (setq m (vlax-vla-object->ename a))) ) m ) (setq p1 (cdr (assoc 10 (setq el (entget m))))) (setq p2 (getpoint p1 "\nSpecify second point: ")) ) (entmakex (append (vl-remove-if '(lambda (x) (= 330 (car x))) el) (list (cons 10 p2)))) ) (princ) ) How can I convert the text size for insertion to the number x by 0.001, that is, if the size is 4250, then we get 4.250 when inserting? Thanks! Quote
ronjonp Posted January 29 Posted January 29 (edited) Something like this? (defun c:foo (/ d e el m p1 p2) (cond ((and (setq e (car (entsel "\nPick dimension: "))) (vlax-property-available-p (vlax-ename->vla-object e) 'measurement) (setq d (vla-get-measurement (vlax-ename->vla-object e))) (progn (vlax-for a (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (cdr (assoc 2 (entget e))) ) (and (= "AcDbMText" (vla-get-objectname a)) (setq m (vlax-vla-object->ename a))) ) m ) (setq p1 (cdr (assoc 10 (setq el (entget m))))) (setq p2 (getpoint p1 "\nSpecify second point: ")) ) (setq e (entmakex (append (vl-remove-if '(lambda (x) (= 330 (car x))) el) (list (cons 10 p2)))) ) (vla-put-textstring (setq e (vlax-ename->vla-object e)) (vl-princ-to-string (* 0.001 d))) (vla-put-rotation e 0.) ) ) (princ) ) Edited January 30 by ronjonp 2 Quote
Nikon Posted January 30 Posted January 30 (edited) 8 hours ago, ronjonp said: (vla-put-height (setq e (vlax-ename->vla-object e)) (* 0.001 (vla-get-height e))) @ronjonp thanks. This code reduces the height of the text, but I need to reduce the dimension value (x 0.001) and insert the text (angle text 0, text height = height of the dimtext). Edited January 30 by Nikon Quote
Nikon Posted January 30 Posted January 30 (edited) On 7/13/2022 at 8:31 PM, mhupp said: ;; Copy dimension value to another location (defun C:DimCopy (/ dim BP LastEnt en) Probably, for my task, it will be easier to change the @mhupp code. ;; Copy dimension value to another location (x0.001) + text angle = 0 ;; DimCopy.lsp the original / creator mhupp ;; https://www.cadtutor.net/forum/topic/75587-help-with-extracting-text-from-one-dimension/#findComment-597630 ;; modification using AI (defun _DimCopy001:OnlyNum (s / lst out c) ;; we leave only numbers, minus sign, period/comma (setq lst (vl-string->list s) out "") (foreach c lst (if (member c (vl-string->list "0123456789-.,")) (setq out (strcat out (chr c))) ) ) ;; comma -> period (vl-string-subst "." "," out) ) (defun _DimCopy001:SetText (e / ed txt num new r50) (setq ed (entget e) txt (cdr (assoc 1 ed))) ;; change the text to *0.001 (if (and txt (/= txt "")) (progn (setq txt (_DimCopy001:OnlyNum txt)) (if (and txt (/= txt "")) (progn (setq num (atof txt)) (setq new (rtos (* num 0.001) 2 3)) ; for example 4250 -> 4.250 (setq ed (subst (cons 1 new) (assoc 1 ed) ed)) ) ) ) ) ;; ang 0 (DXF 50) (if (setq r50 (assoc 50 ed)) (setq ed (subst (cons 50 0.0) r50 ed)) (setq ed (append ed (list (cons 50 0.0)))) ) (entmod ed) (entupd e) ) (defun C:DimCopy001Txt (/ dim BP LastEnt en obj oldEcho) (vl-load-com) (setq oldEcho (getvar 'cmdecho)) (setvar 'cmdecho 0) (while (setq dim (car (entsel "\nSelect Dimension: "))) (setq obj (vlax-ename->vla-object dim)) (setq BP (vlax-get obj 'TextPosition)) (setq LastEnt (entlast)) (command "_.Copy" dim "" "_non" BP (getpoint BP "\nCopy to: ")) (command "_Explode" (entlast)) (if (setq en (entnext LastEnt)) (while en (cond ((= "MTEXT" (cdr (assoc 0 (entget en)))) (command "_Explode" en) ; convert mtext to text ) ((= "TEXT" (cdr (assoc 0 (entget en)))) (_DimCopy001:SetText en) ; <<< scale + angle 0 ) (t (entdel en) ) ) (setq en (entnext en)) ) ) ) (setvar 'cmdecho oldEcho) (princ) ) Perhaps this code can be made prettier and shorter... Edited January 30 by Nikon Quote
ronjonp Posted January 30 Posted January 30 8 hours ago, Nikon said: @ronjonp thanks. This code reduces the height of the text, but I need to reduce the dimension value (x 0.001) and insert the text (angle text 0, text height = height of the dimtext). Code updated above ... give it a try! 1 1 Quote
Nikon Posted January 30 Posted January 30 28 minutes ago, ronjonp said: Code updated above ... give it a try! @ronjonp Yes, thank you very much. It's perfect now! Sorry for explaining it wrong at the beginning. Quote
ronjonp Posted January 30 Posted January 30 40 minutes ago, Nikon said: @ronjonp Yes, thank you very much. It's perfect now! Sorry for explaining it wrong at the beginning. Glad to help : ) 1 Quote
Steven P Posted 2 hours ago Posted 2 hours ago (edited) On 1/30/2026 at 6:59 AM, Nikon said: @ronjonp thanks. This code reduces the height of the text, but I need to reduce the dimension value (x 0.001) and insert the text (angle text 0, text height = height of the dimtext). Converting mm dimension to m? My preference would be to leave the dimension to measure properly and adjust the scale in the properties to 0.001, then you can just copy the text and everything is consistent. Edited 2 hours ago by Steven P Quote
Nikon Posted 1 hour ago Posted 1 hour ago (edited) 59 minutes ago, Steven P said: My preference would be to leave the dimension to measure properly and adjust the scale in the properties to 0.001, then you can just copy the text and everything is consistent. I use the dimensions in the drawing in mm. I need a copy of the dimensional text in m for further calculations. Therefore, the @ronjonp code is quite suitable for me. Edited 1 hour ago by Nikon Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.