Code Red > AutoLISP (Vanilla / Visual)

digging in the paper space

(1/1)

DEVITG:
By this

File_name is "F:\\lisp\\xxxx\\room 004.dwg"
 

   
--- Code: ---   (setq odbx (vlax-get-or-create-object
(strcat "ObjectDBX.AxDbDocument."
(substr (getvar "ACADVER") 1 2))))

   
    (vla-open odbx file_name)

(setq model (vla-get-modelspace odbx))

    (setq each-at (vla-item model 2))
--- End code ---


I can get  an object , and by

         
--- Code: ---(vlax-for each-at  model 
--- End code ---

I can loop to each object to work on it , as to check for text and do a search
 

How can I do the same with objects at each Paper space layouts ??







CAB:
Try this:

--- Code: ---(vlax-map-collection
  (vla-get-PaperSpace
    (vla-get-ActiveDocument (vlax-get-Acad-Object)))
  'vlax-dump-object
)
--- End code ---

gile:
Salud,

You can iterate through the layouts collection.
Each layout is almost  constituted by two objects : a plot configuration (layout object) and a block which countains the graphical objects (viewports...)

The following example print all graphical objects for each layout of the document


--- Code: ---(vlax-for layout (vla-get-Layouts odbx)
  (and (/= (setq name (vla-get-Name layout)) "Model")
       (princ (vla-get-Name layout))
       (vlax-for obj (vla-get-Block layout)
(print (vla-get-ObjectName obj))
       )
       (terpri)
  )
)
--- End code ---

DEVITG:
Gile , I got it , thanks for it .




Navigation

[0] Message Index

Go to full version