Jump to content

Routine modification Dims2Field


Luís Augusto

Recommended Posts

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...