Author Topic: Synchronizing two instances of AutoCADs display window  (Read 4010 times)

0 Members and 1 Guest are viewing this topic.

chierchio

  • Guest
Synchronizing two instances of AutoCADs display window
« on: November 15, 2010, 07:19:51 AM »
I was curious if anyone has written something that will syncronize 2 instances of AutoCAD's display window. I am moving around a lot in a source drawing to paste into others and a LISP that would do this would be sooo nice.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Synchronizing two instances of AutoCADs display window
« Reply #1 on: November 15, 2010, 06:15:51 PM »
Hi Chierchio...

first...I can't beleive that your post have been seen by many...and no one reply with any welcome on theswamp.. :pissed:

so...
Welcome aboard  !  :wink:

second...may I ask you why you need to synchronise 2 instance of CAD ?
Keep smile...

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Synchronizing two instances of AutoCADs display window
« Reply #2 on: November 15, 2010, 06:20:18 PM »
I was curious if anyone has written something that will syncronize 2 instances of AutoCAD's display window. I am moving around a lot in a source drawing to paste into others and a LISP that would do this would be sooo nice.
does Right-Click paste to original coordinates not do this?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Synchronizing two instances of AutoCADs display window
« Reply #3 on: November 15, 2010, 06:50:46 PM »

What do you mean (exactly) by
Quote
syncronize 2 instances of AutoCAD's display window.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

xiaxiang

  • Guest
Re: Synchronizing two instances of AutoCADs display window
« Reply #4 on: November 16, 2010, 04:50:22 AM »
Maybe two Viewports in one drawing?

chierchio

  • Guest
Re: Synchronizing two instances of AutoCADs display window
« Reply #5 on: November 16, 2010, 06:28:05 AM »
Thanks for your response and your welcome to the swamp.

The reason it would be nice to have the windows synchronize is that I am working on a job that covers a varied area in all directions. I am putting together some construction sequencing and on one monitor I have a instance of AutoCAD with source drawing that shows all the facilities and infrastructure and on the other monitor, another instance of AutoCAD that has drawings that show construction progress month by month. I am looking at a plan on my desk and on  on moving to the location in the source where I need to copy from, then go to the stepped drawing to drop it in. Of course there is a little more to it than that. Copy to original coordinates is fine, but there is a lot of information to do with and going around and searching for this is a bit painful.
I was just curious if anyone knew of a lisp that would help. I can try and write it myself, but why reinvent the wheel.

I was thinking either
a) an invisible attributed block that gets written and read, deleted then purged
or
b) registry write and read

I kind of think b is the better way to go. I believe there is a simple V-LAX procedure to do it. I wrote one 6-7 years ago, but I'd have to go through the procedure again.

Thoughts ?


Thanks,

Chris
« Last Edit: November 16, 2010, 06:36:05 AM by chierchio »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Synchronizing two instances of AutoCADs display window
« Reply #6 on: November 16, 2010, 11:05:30 AM »
If you want it to function in two different sessions of Acad, then you will have to write to an external source from one, and read from the other.  I would just write to a temp file, as I don't like messing with the registry if I don't have to, and with writing to a temp file, you can format it any way you want to.
Tim

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

Please think about donating if this post helped you.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Synchronizing two instances of AutoCADs display window
« Reply #7 on: November 16, 2010, 11:13:13 AM »
I'm thinking that simply XREFerencing the two drawings together and using COPY NESTED would achieve the desired results and not need two instances of cad or any code to accomplish.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Synchronizing two instances of AutoCADs display window
« Reply #8 on: November 16, 2010, 11:20:06 AM »
I'm thinking that simply XREFerencing the two drawings together and using COPY NESTED would achieve the desired results and not need two instances of cad or any code to accomplish.
I agree completely, but there may be other things that we are not aware of going on here....or a lot of stuff that needs to be copied.

I would also suggest copy with base point.

But if you do want to do this, I strongly recommend a temp file, do not edit the registry (the fewer registry edits the better, otherwise you risk registry fragmentation).

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Synchronizing two instances of AutoCADs display window
« Reply #9 on: November 16, 2010, 01:05:45 PM »
Was bored, so thought about this a little, and come up with this.  It is a reactor that will update a text file with the coordinates of the zoom window when you make that drawing not active.

Code: [Select]
(defun DeactiveDoc ( react lst / VpCords )

    (defun VPCords ( )
        ; by MP @ theswamp.org
        (   (lambda (offset)
                (   (lambda (viewctr)
                        (list
                            (mapcar '- viewctr offset)
                            (mapcar '+ viewctr offset)
                        )
                    )
                    (getvar "viewctr")
                )
            )
            (   (lambda (halfHeight aspectRatio)
                    (list
                        (* halfHeight aspectRatio)
                        halfHeight
                    )
                )
                (* 0.5 (getvar "viewsize"))
                (apply '/ (getvar "screensize"))
            )
        )
    )
    ;------------------------------------------------
    (   
        (lambda ( x )
            (foreach i (VpCords)
                (print i x)
            )
            (close x)
        )
        (open "c:/temp/log.log" "w")
    )
)

(if (not GlbReactorDocumentDeactive)
    (setq GlbReactorDocumentDeactive (vlr-docmanager-reactor "tmw:DocumentDeactive" '((:vlr-documentToBeDeactivated . DeactiveDoc))))
)

This next code will zoom the current drawing to the other drawings same coordinates, but you will have to run it when you go to the drawing.

Code: [Select]
(defun c:ZoomTo ( / LogPath Opened ll ur )
    (setq LogPath "c:/temp/log.log")
    (if (findfile LogPath)
        (progn
            (setq Opened (open LogPath "r"))
            (read-line Opened)
            (setq ll (append (read (read-line Opened)) '(0.0)))
            (setq ur (append (read (read-line Opened)) '(0.0)))
            (close Opened)
            (vlax-invoke (vlax-get-Acad-Object) 'ZoomWindow ll ur)
        )
        (prompt "\n No file found.")
    )
    (princ)
)
Tim

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

Please think about donating if this post helped you.