Author Topic: CopyObjects and Layouts (also trans DCS ObjectDBX)  (Read 3687 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
CopyObjects and Layouts (also trans DCS ObjectDBX)
« on: February 16, 2017, 11:29:36 AM »
I though it might be fun to see what I can come up with for a better Tab -> Drawings routine.  I had to use one a couple of months ago, and would have liked it to be smarter, so I thought to create one which would look at all viewports per layout, and only copy those model space objects that are visible through the viewports per layout.  Base is working expect two parts:

1) One of the layouts does not seem to be self generating a main viewport.  I do not see a real pattern, as I thought it was the last tab, so I created a new one through the right-click menu, and it would still not create the viewport.  I reordered the tab, and the same issue happened.  I tried creating a new layout by the command line, and it was still there.  Here is an output for the command (does not matter if called from current drawing or ObjectDBX):
Quote
Command: T2D
Layout: created, before: 0, after: 3, copied: 3
Layout: copy2, before: 0, after: 5, copied: 4
Layout: test2, before: 0, after: 5, copied: 4
Layout: yes, before: 0, after: 4, copied: 3
Layout: yes (2), before: 0, after: 4, copied: 3
Command:
you can see that all have 1 more object in the layout space than the copied amount except the 'created' drawing.  Everything time I run the command, it is always the 'created' layout which does not get the correct amount of objects.  Before it was the 'test2' layout.  Between testing, I created the 'yes (2)' layout, but the 'test2' layout would still be the layout with the wrong amount of objects.

2) I have not been able to find a way to 'trans' the viewport coordinate for the viewport center (of model space) to WCS.  I want this to work with ODBX, so I cannot change into model space and use (trans pt 2 0).  I will continue to look for this answer.

The test drawing is attached.  Right now the default save path is "c:/test/", but that can be changed.  Also with the ODBX version of the command, it looks for the attached drawing in the same directory.

edit:  updated code, add Gile's routine per Lee's link.
edit:  updated code to correct issue 1 in this post
Code: [Select]
(defun c:TabsToDwgs ()
    (tabsToDwgs (vla-get-ActiveDocument (vlax-get-Acad-Object)) "c:/test/" nil)
    (princ)
)
;======================================================

(defun c:t2d ( / *error* dbxdoc oVer dir)
   
    (defun *error* (msg)
        (if (and dbxdoc (not (vlax-object-released-p dbxdoc)))
            (vlax-release-object dbxdoc)
        )
        (if msg (vl-bt))
    )
;------------------------------------------------------
    (setq dbxdoc
        (if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
            (vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
            (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
        )
    )
    (setq dir "c:/test/")
    (vla-Open dbxdoc (strcat dir "tabs2dwgs.dwg") :vlax-true)
    (tabsToDwgs dbxdoc "c:/test/" t)
    (*error* nil)
    (princ)
)
;======================================================

(defun tabsToDwgs ( doc dir needrelease / *error* getItems doesIntersect
                    getBoundingPoints isWithinCross getViewPoints findLike
                    doesPropertyMatch
                    doc name lst vplist fvp lolist msobjs xdata pt sc wd ht
                    pts tlist olist dbxdoc oVer dir vp acname polist )
;-------------------------------------------------------
    (defun *error* (msg)
        (if dbxdoc (vlax-release-object dbxdoc))
        (if (and doc needrelease) (vlax-release-object doc))
        (if msg (vl-bt))
    )
;------------------------------------------------------
    (defun getItems (lst code pos / cnt rtn )
        (setq cnt 0)
        (foreach i lst
            (if (equal (car i) code)
                (progn
                    (setq cnt (1+ cnt))
                    (if (member cnt pos)
                        (setq rtn (cons (cdr i) rtn))
                    )
                )
            )
        )
        (reverse rtn)
    )
;-------------------------------------------------------
    (defun doesIntersect ( pt pt2 pts on )
        (or
            (inters pt pt2 (car pts) (cadr pts) on)
            (inters pt pt2 (cadr pts) (caddr pts) on)
            (inters pt pt2 (caddr pts) (cadddr pts) on)
            (inters pt pt2 (car pts) (cadddr pts) on)
        )
    )
;-------------------------------------------------------
    (defun getBoundingPoints ( obj / ll ur err )
        (cond
            ((= (vla-get-ObjectName obj) "AcDbXline")
               (list
                   (vlax-get obj 'BasePoint)
                   (vlax-get obj 'SecondPoint)
               )
            )
            (t
                (setq err
                    (vl-catch-all-apply
                        (function vla-GetBoundingBox)
                        (list obj 'll 'ur)
                    )
                )
                (if
                    (not
                        (and
                            (vl-catch-all-error-p err)
                            (= (vl-catch-all-error-message err)
                                "Automation Error. Null extents")
                        )
                    )
                    (progn
                        (setq ll (safearray-value ll))
                        (setq ur (safearray-value ur))
                        (list
                            ll
                            (list (car ll) (cadr ur) (caddr ll))
                            ur
                            (list (car ur) (cadr ll) (caddr ll))
                        )
                    )
                )
            )
        )
    )
;-------------------------------------------------------
    (defun isWithinCross ( objpts bndpts / ll ur err )
        (if (equal (length objpts) 2)
            (doesIntersect (car objpts) (cadr objpts) bndpts nil)
            (progn
                (or
                    (and
                        (<= (caar bndpts) (caar objpts) (caaddr bndpts))
                        (<= (cadar bndpts) (cadar objpts) (cadadr bndpts))
                        (<= (caar bndpts) (caaddr objpts) (caaddr bndpts))
                        (<= (cadar bndpts) (cadar (cddr objpts)) (cadadr bndpts))
                    )
                    (doesIntersect (car objpts) (cadr objpts)  bndpts t)
                    (doesIntersect (cadr objpts) (caddr objpts)  bndpts t)
                    (doesIntersect (caddr objpts) (cadddr objpts)  bndpts t)
                    (doesIntersect (cadddr objpts) (car objpts)  bndpts t)
                )
            )
        )
    )
;-------------------------------------------------------
    (defun getViewPoints ( vp / xdata pt sc wd ht )
        (setq xdata (MyGetXdata vp "ACAD"))
        (setq pt (PCS2WCS (vlax-get vp 'Center) vp))
        (setq sc (vlax-get vp 'CustomScale))
        (setq wd (/ (vlax-get vp 'Width) sc 2))
        (setq ht (/ (vlax-get vp 'Height) sc 2))
        (list
            (list (- (car pt) wd) (- (cadr pt) ht))
            (list (- (car pt) wd) (+ (cadr pt) ht))
            (list (+ (car pt) wd) (+ (cadr pt) ht))
            (list (+ (car pt) wd) (- (cadr pt) ht))
        )
    )
;-------------------------------------------------------
    (defun doesPropertyMatch ( o1 o2 prop )
        (equal (vlax-get o1 prop) (vlax-get o2 prop))
    )
;-------------------------------------------------------
    (defun findLike ( src olist / obj )
        (foreach o olist
            (if
                (and
                    (doesPropertyMatch src o "ObjectName")
                    (doesPropertyMatch src o "Center")
                    (doesPropertyMatch src o "CustomScale")
                    (doesPropertyMatch src o "Direction")
                    (doesPropertyMatch src o "Height")
                    (doesPropertyMatch src o "TwistAngle")
                    (doesPropertyMatch src o "Width")
                )
                (setq obj o)
            )
        )
        obj
    )
;-------------------------------------------------------
    ;; PCS2WCS (gile)
    ;; Translates a point PaperSpace coordinates to WCS coordinates
    ;; according to the specified viewport
    ;;
    ;; (PCS2WCS pt vp) is the same as (trans (trans pt 3 2) 2 0) when vp is active
    ;;
    ;; Arguments
    ;; pt : a point
    ;; vp : the viewport (ename or vla-object)

    (defun PCS2WCS (pt vp / ang nor scl mat)
      (vl-load-com)
      (and (= (type vp) 'VLA-OBJECT)
           (setq vp (vlax-vla-object->ename vp))
      )
      (setq pt   (trans pt 0 0)
        elst (entget vp)
        ang  (- (cdr (assoc 51 elst)))
        nor  (cdr (assoc 16 elst))
        scl  (/ (cdr (assoc 45 elst)) (cdr (assoc 41 elst)))
        mat  (mxm
               (mapcar (function (lambda (v) (trans v 0 nor T)))
                   '((1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0))
               )
               (list (list (cos ang) (- (sin ang)) 0.0)
                 (list (sin ang) (cos ang) 0.0)
                 '(0.0 0.0 1.0)
               )
             )
      )
      (mapcar '+
          (mxv mat
               (mapcar '+
                   (vxs pt scl)
                   (vxs (cdr (assoc 10 elst)) (- scl))
                   (cdr (assoc 12 elst))
               )
          )
          (cdr (assoc 17 elst))
      )
    )

    ;; VXS Multiply a vector by a scalar
    ;;
    ;; Arguments : a vector and a real

    (defun vxs (v s) (mapcar (function (lambda (x) (* x s))) v))

    ;; VXV (gile)
    ;; Returns the dot product of two vectors (real)
    ;;
    ;; Arguments : two vectors
    ;; return : a real number

    (defun vxv (v1 v2) (apply '+ (mapcar '* v1 v2)))

    ;; TRP
    ;; transposes a matrix -Doug Wilson-
    ;;
    ;; Argument : a matrix
    ;; return : a matrix

    (defun trp (m) (apply 'mapcar (cons 'list m)))

    ;; MXV
    ;; Applies a transformation matrix to a vector  -Vladimir Nesterovsky-
    ;;
    ;; Arguments : une matrice et un vecteur
    ;; return : a vector

    (defun mxv (m v)
      (mapcar '(lambda (r) (vxv r v)) m)
    )

    ;; MXM
    ;; Multiplies (combinates) two matrices -Vladimir Nesterovsky-
    ;;
    ;; Arguments : deux matrices
    ;; return : a matrix

    (defun mxm (m q)
      (mapcar '(lambda (r) (mxv (trp q) r)) m)
    )
;-------------------------------------------------------
    (setq acname (vla-get-Name (vla-get-Layout (vla-get-PaperSpace doc))))
    (vlax-for lo (vla-get-Layouts doc)
        (setq name (vla-get-Name lo))
        (setq lst nil)
        (setq vplist nil)
        (Setq fvp nil)
        (vlax-for o (vla-get-Block lo)
            (setq lst (cons o lst))
            (if (and
                    (equal (vla-get-ModelType lo) :vlax-false)
                    (= (vla-get-ObjectName o) "AcDbViewport")
                )
                (setq vplist (cons (cons o (getViewPoints o)) vplist))
            )
            (if (and vplist (not fvp))
                (progn
                    (setq fvp t)
                    (setq vplist nil)
                    (setq lst (vl-remove o lst))
                )
            )
        )
        (setq lolist
            (cons
                (list
                    name
                    (cons "objects" lst)
                    (cons "viewports" vplist)
                )
                lolist
            )
        )
    )
    (setq msobjs (cdr (assoc "objects" (cdr (assoc "Model" lolist)))))
    (foreach o msobjs
        (if (setq bpts (getBoundingPoints o))
            (foreach l lolist
                (setq name (car l))
                (foreach vp (cdr (assoc "viewports" (cdr l)))
                    (if (isWithinCross bpts (cdr vp))
                        (if (setq tlist (assoc name olist))
                            (if (not (vl-position o (cdr tlist)))
                                (setq olist
                                    (subst
                                        (cons name (cons o (cdr tlist)))
                                        tlist
                                        olist
                                    )
                                )
                            )
                            (setq olist (cons (cons name (list o)) olist))
                        )
                    )
                )
            )
        )
    )
    (foreach l lolist
        (setq name (car l))
        (if (/= name "Model")
            (progn
                (setq dbxdoc
                    (if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
                        (vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
                        (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
                    )
                )
                (if (setq tlist (cdr (assoc name olist)))
                    (vlax-invoke
                        doc
                        'CopyObjects
                        tlist
                        (vla-get-ModelSpace dbxdoc)
                    )
                )
                (if (= name acname)
                    (setq vp (vlax-invoke (vla-get-PaperSpace dbxdoc) 'AddpViewport '(0. 0. 0.) 1. 1.))
                )
                (setq polist (cdr (assoc "objects" (cdr l))))
                (setq objs
                    (vlax-invoke
                        doc
                        'CopyObjects
                        polist
                        (vla-get-Block (vla-item (vla-get-Layouts dbxdoc) "Layout1"))
                    )
                )
                (if vp (vla-Delete vp))
                (vla-SaveAs dbxdoc (strcat dir name ".dwg"))
                (if vp
                    (progn
                        (setq vp nil)
                        (vla-Open dbxdoc (strcat dir name ".dwg"))
                        (vlax-for o (vla-get-Block (vla-item (vla-get-Layouts dbxdoc) "Layout1"))
                            (if
                                (and
                                    (= (vla-get-ObjectName o) "AcDbViewport")
                                    (setq obj (findLike o polist))
                                )
                                (vla-put-ViewportOn o (vla-get-ViewportOn obj))
                            )
                        )
                        (vla-SaveAs dbxdoc (strcat dir name ".dwg"))
                    )
                )
                (vlax-release-object dbxdoc)
                (setq dbxdoc nil)
            )
        )
 
    )
    (*error* nil)
    (princ)
)

I think I have included everything.

Thanks in advance.
« Last Edit: February 17, 2017, 04:36:44 AM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #1 on: February 16, 2017, 01:23:48 PM »
2) (assoc 12 (entget (vlax-vla-object->ename vp)))

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #2 on: February 16, 2017, 02:17:05 PM »
2) (assoc 12 (entget (vlax-vla-object->ename vp)))
This will not work with ObjectDBX, and it will return the point in DCS on WCS.  I get the point through the xdata of the viewport already, but I need to translate this to WCS to use it correctly.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #3 on: February 16, 2017, 03:09:35 PM »
I see ways to do it in other languages like
Code: [Select]
    public static Matrix3d GetModelToPaperTransform( this Viewport vport )
      {
         if( vport.PerspectiveOn )
            throw new NotSupportedException( "Perspective views not supported" );
         Point3d center = new Point3d( vport.ViewCenter.X, vport.ViewCenter.Y, 0.0 );
         return Matrix3d.Displacement( new Vector3d( vport.CenterPoint.X - center.X, vport.CenterPoint.Y - center.Y, 0.0 ) )
            * Matrix3d.Scaling( vport.CustomScale, center )
            * Matrix3d.Rotation( vport.TwistAngle, Vector3d.ZAxis, Point3d.Origin )
            * Matrix3d.WorldToPlane( new Plane( vport.ViewTarget, vport.ViewDirection ) );
      }
Post by Tony T. here.  But my matrix skills are not good anymore (and were pretty bad to begin with).  I will continue to try and come up with something though.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #4 on: February 16, 2017, 04:51:09 PM »
This will not work with ObjectDBX
this is strange :(
i added
Code: [Select]
      (princ pt)
      (princ " - ")
      (princ (assoc 12 (entget (vlax-vla-object->ename vp))))
      (terpri)
to your getViewPoints function and it shows exactly same numbers
Code: [Select]
Command: t2d
(-0.384011 2.37939) - (12 -0.384011 2.37939 0.0)
(38.7287 12.3909) - (12 38.7287 12.3909 0.0)
(38.7287 12.3909) - (12 38.7287 12.3909 0.0)
(5.37515 4.12509) - (12 5.37515 4.12509 0.0)
(54.793 7.48866) - (12 54.793 7.48866 0.0)
(-0.384011 2.37939) - (12 -0.384011 2.37939 0.0)
(38.7287 12.3909) - (12 38.7287 12.3909 0.0)
(38.7287 12.3909) - (12 38.7287 12.3909 0.0)
(8.84134 5.7006) - (12 8.84134 5.7006 0.0)
(17.9453 12.786) - (12 17.9453 12.786 0.0)
(8.84134 5.7006) - (12 8.84134 5.7006 0.0)
(17.9453 12.786) - (12 17.9453 12.786 0.0)

Layout: created, before: 0, after: 3, copied: 3
Layout: copy2, before: 0, after: 5, copied: 4
Layout: test2, before: 0, after: 5, copied: 4
Layout: yes, before: 0, after: 4, copied: 3
Layout: yes (2), before: 0, after: 4, copied: 3

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #5 on: February 16, 2017, 05:02:14 PM »
Maybe I am wrong VovKa.  I did not test currently, but relied on my past knowledge.  I'll try here tomorrow and see if I get the same thing (which I suspect I will).

But that solution only gives me the point in DCS not WCS.  I need a way to get the point in WCS to use it later in the code.
Quote from: Acad Help
12    View center point (in DCS)
         DXF: X value; APP: 2D point

If I can use the entdata data (instead of just the ActiveX stuff) then maybe there is a solution I have not thought of yet.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #6 on: February 16, 2017, 05:11:15 PM »
Perhaps you could use gile's PCS2WCS function from here.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #7 on: February 16, 2017, 06:28:38 PM »
Thanks for the link, Lee.  I knew Gile had to have something floating around, but I could not find it in my limited searching.  I will try this in a little while, as I cannot seem to sleep.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #8 on: February 16, 2017, 08:03:50 PM »
Question 2 is solved (thanks to Gile's code).

Number 1 still happens.  Now I know which tab will cause the error though.  It is the last active paper space tab.  How to fix it will have to wait, as my bed is calling me now.

The updated code seems to work well though.
Quote

Command: tabstodwgs

Layout: E9, before: 0, after: 3, copied: 2 [ 1407 ]
Layout: E8, before: 0, after: 3, copied: 2 [ 495 ]
Layout: E7, before: 0, after: 3, copied: 2 [ 501 ]
Layout: E6, before: 0, after: 3, copied: 2 [ 1260 ]
Layout: E5, before: 0, after: 3, copied: 2 [ 285 ]
Layout: E4, before: 0, after: 3, copied: 2 [ 2488 ]
Layout: E35, before: 0, after: 3, copied: 2 [ 294 ]
Layout: E34, before: 0, after: 3, copied: 2 [ 264 ]
Layout: E33, before: 0, after: 3, copied: 2 [ 337 ]
Layout: E32, before: 0, after: 3, copied: 2 [ 306 ]
Layout: E31, before: 0, after: 3, copied: 2 [ 260 ]
Layout: E30, before: 0, after: 3, copied: 2 [ 368 ]
Layout: E3, before: 0, after: 3, copied: 2 [ 454 ]
Layout: E29, before: 0, after: 3, copied: 2 [ 391 ]
Layout: E28, before: 0, after: 3, copied: 2 [ 460 ]
Layout: E27, before: 0, after: 3, copied: 2 [ 271 ]
Layout: E26, before: 0, after: 3, copied: 2 [ 387 ]
Layout: E25, before: 0, after: 3, copied: 2 [ 462 ]
Layout: E24, before: 0, after: 3, copied: 2 [ 271 ]
Layout: E23, before: 0, after: 3, copied: 2 [ 29 ]
Layout: E22, before: 0, after: 3, copied: 2 [ 336 ]
Layout: E21, before: 0, after: 3, copied: 2 [ 221 ]
Layout: E20, before: 0, after: 3, copied: 2 [ 37 ]
Layout: E2, before: 0, after: 3, copied: 2 [ 370 ]
Layout: E19, before: 0, after: 3, copied: 2 [ 137 ]
Layout: E18, before: 0, after: 3, copied: 2 [ 878 ]
Layout: E17, before: 0, after: 3, copied: 2 [ 1564 ]
Layout: E16, before: 0, after: 3, copied: 2 [ 3139 ]
Layout: E15, before: 0, after: 3, copied: 2 [ 87 ]
Layout: E14, before: 0, after: 3, copied: 2 [ 266 ]
Layout: E13, before: 0, after: 3, copied: 2 [ 29 ]
Layout: E12, before: 0, after: 3, copied: 2 [ 604 ]
Layout: E11, before: 0, after: 3, copied: 2 [ 603 ]
Layout: E10A, before: 0, after: 3, copied: 2 [ 488 ]
Layout: E10, before: 0, after: 3, copied: 2 [ 1068 ]
Layout: E1, before: 0, after: 2, copied: 2 [ 141 ] <------
Model space has over 20,000 objects.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #9 on: February 17, 2017, 04:35:14 AM »
Question 1 is solved (with a couple workarounds).

First workaround: create a new viewport in the drawing that is created by the active paperspace layout before copying objects, and then delete the created viewport (not copied).  Not sure if order matters, but since it worked I left it this way.

So then the number of items were correct, and shown in the correct locations, but all the viewports were off (no matter the status in the original drawings) after items are copied.

Second workaround: save the newly created drawing and then open again with ObjectDBX and match the viewport on status to the original drawing.

The code in the first post is updated per this thread so far.  This base works with both options (from the current drawing and a drawing passed opened through ObjectDBX).  Now to make a better interface and output options.

Thanks for the help guys.
« Last Edit: February 17, 2017, 04:39:48 AM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #10 on: February 17, 2017, 06:06:21 AM »
will not work with this file  :cry:

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #11 on: February 17, 2017, 06:48:20 AM »
will not work with this file  :cry:
You are correct.  With some quick test, I cannot see to find the center point correctly in model space (in WCS); either through Gile's code or the 'trans' function.

I will investigate further to see what I can come up with as the issue.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #12 on: February 20, 2017, 01:46:18 PM »
I cannot seem to find a fix or workaround to the problem VovKa.  I have tried to go the other way, take the points returned from the vla-GetBoundingBox and bring them into paper space.  This appears to work, but the points get a Z value, so that does not seem to be correct either.  Plus in large drawings this kills the speed, to make the program unusable.

The command 'chspace' works with your example, so there has to be a way to get a correct transformation matrix, but the code I have tried (by Gile) does not work and my weak attempts have failed also.

For now I have to let this be.  In between school work and work-work I will keep trying to make this more complete, but until then I will just leave a notice on the dialog to check the output.

Edit: Here is the program thread.
« Last Edit: February 20, 2017, 02:13:43 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #13 on: February 21, 2017, 11:23:46 AM »
VovKa,

Had a few hours and a new idea.  It appears to work on your test drawing.  I even added stuff and changed the view direction (attached drawing), and it works on that drawing also and my other test drawings. The new lisp is here (as TabsToDwgsv1.1.lsp).
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

VovKa

  • Water Moccasin
  • Posts: 1628
  • Ukraine
Re: CopyObjects and Layouts (also trans DCS ObjectDBX)
« Reply #14 on: February 21, 2017, 01:08:05 PM »
here's another one :)


P.S. you forgot to remove (setq xdata (MyGetXdata vp "ACAD")) from your code