Jump to content

Capture Viewport Lisp


mvr600

Recommended Posts

Hello,

I'm using Civil 3D and I have different projects that involve capturing the map background on paperspace (Capture Viewport), I have to do it by viewport since that is the best quality. Each project has 80 to 130 sheets. Currently, I have created a quick action record but still takes time and have to go to the next sheet manually.

Does anybody have a lisp to do this repetitive action?

 

Thank you.

Link to comment
Share on other sites

Can you post a sample drawing, I am not quite sure what you are wanting. 

 

A second thing you could do - and that might almost write the LISP for you.. is write down all the steps you do manually. Get it working for one viewport and the change to select all of them is usually quite easy

  • Like 1
Link to comment
Share on other sites

Hi Steven,

 

Here is lisp that I got from Tcorey on the Autodesk forum. It works for one sheet, but I need it to it go through all of the sheets in the project.

 

(defun c:go ( / )

(vl-load-com)

(vl-cmdf "_mspace")

(vl-cmdf "_geomap" "_H")

(vl-cmdf "_geomapimage" "_v")

;(vl-cmdf "_geomap" "_Off") ;remove the ; at the very start of this line and this line will turn off the map, leaving only the captured image. )

 

 

 

Thank you for the help.

Link to comment
Share on other sites

Just look for any sample code that looks for something on layouts, here is  a rough example.

 

(setq lays (layoutlist))
(foreach lay lays
(setvar 'ctab lay)
; do your thing here
)

 

Link to comment
Share on other sites

Hi Bigal,

That is exactly what I did and the lisp below works great for me. I tested it on a 128 sheet document and it took less than 2 min to zoom in place the background, and capture the map.

 

(defun c:go ( / )
(vl-load-com)

(( / app ctb doc )
    (setq app (vlax-get-acad-object)
          doc (vla-get-activedocument app)
          ctb (getvar 'ctab)
    )
    (foreach tab (layoutlist)
        (setvar 'ctab tab)
        (vla-put-mspace doc :vlax-false)
        (vla-zoomextents app)

(vl-cmdf "_mspace")
(vl-cmdf "_geomap" "_H")
(vl-cmdf "_geomapimage" "_v")
(vl-cmdf "_geomap" "_Off")   ;remove the ; at the very start of this line and this line will turn off the map, leaving only the captured image.
)


    )
    (setvar 'ctab ctb)
    (princ)
)
(vl-load-com) (princ) 

  • Like 1
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...