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 yesterday at 11:33 AM Posted yesterday at 11:33 AM 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 18 hours ago Posted 18 hours ago (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 2 hours ago by ronjonp 1 Quote
Nikon Posted 10 hours ago Posted 10 hours ago (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 10 hours ago by Nikon Quote
Nikon Posted 9 hours ago Posted 9 hours ago (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 9 hours ago by Nikon Quote
ronjonp Posted 1 hour ago Posted 1 hour ago 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 Quote
Nikon Posted 1 hour ago Posted 1 hour ago 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 47 minutes ago Posted 47 minutes ago 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
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.