Jump to content
Luís Augusto

Routine modification Dims2Field

Recommended Posts

Luís Augusto

In looking for a lisp routine that performs the sum selected dimensions, found one that I believe to be ideal for my work.

Could the author or another member of the forum to make a change?

It would be ideal for me to make the sum property>%). TextOverride>% Rotated Dimension object.

I tried to make the change but as I am not aware that language still did not succeed. Returns the error "misplaced dot on input".

 

Below the original routine.

 

Dims2Field.lsp

(defun c:Dims2Field ( / *error* spc doc pt uFlag ss ids )
(vl-load-com)
;; © Lee Mac 2010

(defun *error* ( msg )
(and uFlag (vla-EndUndomark doc))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ)
)

(setq spc
(if
(or
(eq AcModelSpace
(vla-get-ActiveSpace
(setq doc
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
)
)
(eq :vlax-true (vla-get-MSpace doc))
)
(vla-get-ModelSpace doc)
(vla-get-PaperSpace doc)
)
)

(if (and (ssget '((0 . "*DIMENSION")))
(setq pt (getpoint "\nPick Point for Field: ")))
(progn
(setq uFlag (not (vla-StartUndoMark doc)))

(vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc))
(setq Ids
(cons (GetObjectID obj doc) Ids)
)
)
(vla-delete ss)

(vla-AddMText spc (vlax-3D-point pt) 0.

(if (= 1 (length Ids))
(strcat "%<\\AcObjProp Object(%<\\_ObjId " (car Ids) ">%).Measurement \\f \"%lu6\">%")
(strcat "%<\\AcExpr"
(lst->str Ids " %<\\AcObjProp Object(%<\\_ObjId " ">%).Measurement >% +")
">%).Measurement >% \\f \"%lu6\">%"
)
)
)

(setq uFlag (vla-EndUndomark doc))
)
)
(princ)
)

(defun lst->str ( lst d1 d2 )
;; © Lee Mac 2010
(if (cdr lst)
(strcat d1 (car lst) d2 (lst->str (cdr lst) d1 d2))
(strcat d1 (car lst))
)
)

(defun GetObjectID ( obj doc )
;; © Lee Mac 2010
(if
(eq "X64"
(strcase
(getenv "PROCESSOR_ARCHITECTURE")
)
)
(vlax-invoke-method
(vla-get-Utility doc) 'GetObjectIdString obj :vlax-false
)
(itoa (vla-get-Objectid obj))
)
)

Thank in advanced.

Luis Augusto.

Share this post


Link to post
Share on other sites
ReMark

We'll give this thread a *bump* and see if it draws any response. Good luck.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×