Greetings. All I need is to know the ObjID of the viewport so I can include it in a script. I have many layouts with one viewport in each. If your product prints it out in text form, I'll sort it out from there.
I'm puting a field in each title block that references the viewport ObjID to indicate the scale. For instance:
%<\AcObjProp Object(%<\_ObjId -1075771920>%).StandardScale2 \f "%en0">%
Showing a viewport ObjID table for all layouts, would also work. You guys are terrific.
Solved! Go to Solution.
Solved by wingfold2001. Go to Solution.
Solved by hmsilva. Go to Solution.
if I understood correctly, something like this perhaps...
(defun c:test ( / HND ITM LAYT LST NUM SS VP) (vl-load-com) ;; by Gilles Chanteau (defun gc:GetObjectIdString (obj) (or *util* (setq *util* (vla-get-Utility (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) ) (if (vlax-method-applicable-p *util* 'GetObjectIdString) (vla-GetObjectIdString *util* obj :vlax-false) (itoa (vla-get-ObjectId obj)) ) );; gc:GetObjectIdString (if (setq ss (ssget "_X" '((0 . "VIEWPORT") (410 . "~Model")))) (progn (setq num (length (layoutlist)) itm -1 ) (while (and (< (length lst) num) (setq hnd (ssname ss (setq itm (1+ itm))))) (setq vp (gc:GetObjectIdString (vlax-ename->vla-object hnd))) (if (not (assoc (setq layt (cdr (assoc 410 (entget hnd)))) lst)) (setq lst (cons (cons layt vp) lst)) ) ) (textscr) (setq lst (reverse lst)) (foreach n lst (princ "\n") (princ n) ) ) ) (princ) )
@ Lee Mac
sorry Lee, but I used part of a code you posted...
I'm getting too lazy
HTH
Henrique
@wingfold2001 wrote:
Thanks for posting. I'll test it after the 1st of the year. V/r
You're welcome, wingfold2001
Let's wait...
Henrique