Jump to content

extract data seen in viewport only + paperspace data


KarlT

Recommended Posts

I work on architects layouts with 100's of rooms per drawing. I use dynamic blocks in each room untill all rooms are completed. I then go to paperspace layout and create 1 viewport (differing shapes) place attributes in paperspace then repeat the process. I am trying to extract data from what is seen in the viewport. At present when I do this it extracts all the data on model space. When this is done I cannot seperate data room by room. deally I would like to output 1 layout to 1 sheet in excel. Any help or part lisp would help. I don't no any lisp but if I can buid up differing things I may be able to get it cobled together. Thanks in advance

Link to comment
Share on other sites

1st In your layouts you can trace over your viewport shape and then from paperspace chspace L enter, this copies the shape to model space.

 

2nd Search for extract data within polygon to excell. Also (ssget "WP" Listofpoints) or to quote help (ssget "WP" Listofpoints filterlist) filterlist may be just blocks or names of certain blocks.

 

3rd You need to search also for viewport boundary points so you can make the polyline automatically and then do step 2

 

Sorry dont have this code buit I am sure others will have.

Link to comment
Share on other sites

This looks like a reallyu good start. I have been looking for a long time. I have the blocks developed but hit this brick wall. Am I to assume If I was to ask what you have written people will understand. I unfortunatley no nothing of LISP (I shall have to learn) Again thank you. If you have part code that may help I would appreciate it.I work withsomeone that can part lisp and we may be able to coble something out of all the different codes to get to where we want.

 

cheers

Link to comment
Share on other sites

I have already had a lot of help - thanks bigal. I have found a lisp routine that only selects what is visable in the viewport. Does anyone know of any lsip routine that could be linked to the one I have found so that I can extract all in the paperspace and select the viewport so that I can extract all one one layout to = one excell spreadsheet. Any help would be appreciated. Thanks in advance. below is the lisp routine I have been lucky enough to find.

 

;;;---------------------------------------------------------------------------;
;;;
;;; vpsel.lsp
;;;
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved
;;; Website: [url="http://www.jtbworld.com"]www.jtbworld.com[/url]
;;; E-mail: [email="info@jtbworld.com"]info@jtbworld.com[/email]
;;;
;;; 2000-04-14 - First release
;;; Tested on AutoCAD 2000
;;;
;;;---------------------------------------------------------------------------;
;;;  DESCRIPTION
;;;
;;;  Select all visible objects in selected or active paperspace viewport
;;;  Works transparently when in modelspace and for polygonal viewports too
;;;  Example1: ERASE ALL R 'VPC >>> Erase all in model except what is visible
;;;  Example2: (command "erase" "all" "r" (c:vpc) "")
;;;  Example3: VPC ERASE >>> VPC is run previous the command and the objects
;;;                            are also in previous selection set
;;;
;;;  c:vpc - select all visible objects with crossing in viewport
;;;  c:vpw - select all visible objects with window in viewport
;;;---------------------------------------------------------------------------;

(defun c:vpc ()
 (vpsel "C")
)

(defun c:vpw ()
 (vpsel "W")
)

(defun dxf (n ed) (cdr (assoc n ed)))

(defun vpsel (typ   /     ad    ss    ent   vpno  ok    vpbl  vpur
             msbl  msur  msul  mslr  ss1   pl    nlist x     n
            )
 (vl-load-com)
 (setq ok t)
 (if (= (getvar "tilemode") 0)
   (progn
     (setq ad (vla-get-activedocument (vlax-get-acad-object)))
     (if (= (getvar "cvport") 1)
       (if (and (= (getvar "cmdactive") 0)
                (/= (setq ss (ssget ":E:S" '((0 . "VIEWPORT")))) nil)
           )
         (progn
           (setq ent (ssname ss 0))
           (setq vpno (dxf 69 (entget ent)))
           (vla-Display (vla-get-activepviewport ad) :vlax-true)
           (vla-put-mspace ad :vlax-true)
           (setvar "cvport" vpno)
         )
         (progn
           (setq ok nil)
           (princ)
         )
       )
       (setq ent (vlax-vla-object->ename (vla-get-activepviewport ad)))
     )
     (if (and ok (/= 1 (logand 1 (dxf 90 (setq ed (entget ent))))))
       (progn
         (if (= (vla-get-clipped (vlax-ename->vla-object ent))
                :vlax-false
             )
           (progn
             (vla-getboundingbox
               (vla-get-activepviewport ad)
               'vpbl
               'vpur
             )
             (setq msbl (trans (vlax-safearray->list vpbl) 3 2))
             (setq msur (trans (vlax-safearray->list vpur) 3 2))
             (setq msul (list (car msbl) (cadr msur)))
             (setq mslr (list (car msur) (cadr msbl)))
             (setq ss1
                    (ssget (strcat typ "P") (list msbl msul msur mslr))
             )
           )
           (progn
             (setq pl (entget (dxf 340 (entget ent))))
             (setq nlist nil)
             (foreach x pl
               (if (eq 10 (car x))
                 (setq nlist (cons (trans (cdr x) 3 2) nlist))
               )
             )
             (setq ss1 (ssget (strcat typ "P") nlist))
           )
         )
         (sssetfirst nil ss1)
         (if ss1
           (setq n (sslength ss1))
           (setq n 0)
         )
         (princ n)
         (princ " found ")
         (if (and ss1 (= (getvar "cmdactive") 1))
           ss1
           (princ)
         )
       )
       (princ)
     )
   )
   (princ)
 )
)

(princ)

Edited by Tiger
added codetags and cleaned up code
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...