Jump to content

SSGET from another drawing's layout


lastknownuser

Recommended Posts

I'm trying to select viewport from layout of another drawing. I'm using functions atached below to get another drawing layouts list, and I'd like get viewport dimensions of a certain layout.
What would be the best way to do this? Any way to use ssget in layout of another drawing to select viewport?

 

(defun getdrawinglayouts ( dwg / doc idx rtn )
    (if (setq doc (LM:getdocumentobject dwg))
        (progn
            (vlax-for lyt (vla-get-layouts doc)
                (setq rtn (cons (vla-get-name lyt) rtn)
                      idx (cons (vla-get-taborder lyt) idx)
                )
            )
            (vlax-release-object doc)
            (mapcar '(lambda ( n ) (nth n rtn)) (vl-sort-i idx '<))
        )
    )
)

(defun LM:getdocumentobject ( dwg / app dbx dwl err vrs )
    (cond
        (   (not (setq dwg (findfile dwg))) nil)
        (   (cdr
                (assoc (strcase dwg)
                    (vlax-for doc (vla-get-documents (setq app (vlax-get-acad-object)))
                        (setq dwl (cons (cons (strcase (vla-get-fullname doc)) doc) dwl))
                    )
                )
            )
        )
        (   (progn
                (setq dbx
                    (vl-catch-all-apply 'vla-getinterfaceobject
                        (list app
                            (if (< (setq vrs (atoi (getvar 'acadver))) 16)
                                "objectdbx.axdbdocument"
                                (strcat "objectdbx.axdbdocument." (itoa vrs))
                            )
                        )
                    )
                )
                (or (null dbx) (vl-catch-all-error-p dbx))
            )
            (prompt "\nUnable to interface with ObjectDBX.")
        )
        (   (vl-catch-all-error-p (setq err (vl-catch-all-apply 'vla-open (list dbx dwg))))
            (prompt (strcat "\n" (vl-catch-all-error-message err)))
        )
        (   dbx   )
    )
)

 

Link to comment
Share on other sites

Ok do it in an entire different way, select client, then select sheet size and orientation. The client specific bits are added to the correct layout. If it's your company layouts only even easier. Just use layout command with "T" option to get from another  dwg.

 

image.png.4f72286c431d857698f495a7a4c3eddd.png

 

This is part of make layouts along pline.

 

Happy to discuss further not free but cheap.

 

image.thumb.png.6a4e6c0d0f44d7ebc9511813e8d64423.png

 

 

  • Like 1
Link to comment
Share on other sites

Thanks for replies, didn't get the answer to my question, maybe because it can't be done, but I managed to get other drawing VP dimensions by importing certain layout from that selected drawing to my drawing, ssget in that layout for viewport and get its dimensions, and then just delete that layout. Thought it will slow down my program but it works very fast.
@BIGAL And that is the idea - to create automatic layouts along certain path, I did that, but not all layouts we use have the same VP dimensions so I wanted to add that option to choose what layouts to create

Link to comment
Share on other sites

The image above is 2 steps create the rectangs then make the layouts so I guess could do different sizes, even down to a rectang is at different scale, ie a detail, you can attach say size and scale to rectang using XDATA. I do something similar for plotting auto detect Landscape and Portrait but it uses block details.

 

So think about step 2.

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...