Author Topic: Copying, Exploding or Changing Viewports in Model Space  (Read 16510 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #15 on: November 16, 2004, 06:21:20 PM »
My reply to that would be no and no.
I don't only desire to know VBA, the fact is that it is enough to be learning VBA, not only as it relates to AutoCAD but as it relates to Excel also.

My work wants me to possibly take a VB course which would be cool and I need to learn how to desire security systems that span across the entire country.

So, in short, I would love to learn LISP as well, I just don't know when and how. Also, I am not sure of the approach for this in VBA as I am still only 6 months into my learning and if I did know, I am not sure that I would spend the time to figure it out. Too many fish to fry :)

I was merely hoping that someone would have a simple answer to my original question

Thank you again

Mark

ML

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #16 on: November 16, 2004, 06:25:49 PM »
Quote

Correct Mark, but if you cut'nPaste as a block then it can be copied, mirrored, arrayed... and then they can be exploded to viewports. The viewport itself cannot be exploded to its primitives.



That's correct Serge

This is why I used Paste Block "BUT" I still have the original problem.
I want the pasted block (which is on defpoints) to be green while the layer defpoints is blue.

Thank you

Mark

CADaver

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #17 on: November 17, 2004, 09:13:04 AM »
Quote from: ML
I was merely hoping that someone would have a simple answer to my


The simple answer is the button macro posted previously.  You also wish to make it complicated by adding sevaeral other parameters to the original question.  The more complicated the problem, the more complicated the solution.

ML

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #18 on: November 17, 2004, 11:20:56 AM »
Yes, this is true but I have to say to myself, my existing macro that I created does X,Y + Z but these macros that people are offering are real nice but they only do X+Y of what I need. So, it isn't really a solution, it is a solution that keeps me saying, well, where is the rest of the answer.

That is the funny things in here, Sometimes you can be as specific as possible, I need it to do "this" but you get a whole bunch of answers that don't address just that.

ELOQUINTET

  • Guest

CADaver

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #20 on: November 17, 2004, 12:48:47 PM »
Quote from: ML
Yes, this is true but I have to say to myself, my existing macro that I created does X,Y + Z but these macros that people are offering are real nice but they only do X+Y of what I need. So, it isn't really a solution, it is a solution that keeps me saying, well, where is the rest of the answer.

That is the funny things in here, Sometimes you can be as specific as possible, I need it to do "this" but you get a whole bunch of answers that don't address just that.


Well now I'm insulted.  Specific my keester, go back and read your bloody posts, every one added a new feature or a new desire to the question, and each time you wanted it simple.  What you're really asking is for someone to read your mind and then provide you with the program desired. You've been given enough information to bang out exactly what you need, but you haven't the time for that, then you have the gonads to throw out a comment like that.

BTW, DW, this is the first post you said anything about "Z", if you'd have checked the button macro previously posted, you'd have noticed it matched the viewport's orientation, including "Z".

ELOQUINTET

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #21 on: November 17, 2004, 01:01:10 PM »
i'm not sure he was talking axis cadaver. take it easy cadaver don't take everything so personal it's just autocad  :roll:

CADaver

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #22 on: November 17, 2004, 01:22:53 PM »
Quote from: eloquintet
i'm not sure he was talking axis cadaver. take it easy cadaver don't take everything so personal it's just autocad  :roll:
This isn't his first time to post thinly-veiled insults when his un-posted needs weren't specifically met.  And when I need someone to tell me to "take it easy" I'll be sure to ask.

ELOQUINTET

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #23 on: November 17, 2004, 01:35:28 PM »
i know we have personality conflicts. i don't see anyone else feeling insulted maybe it's time to look within at why this offends you rather than lashin out at others. i think we're all friends here and i wouldn't intentionally try to hurt anybody let's keep this fun is all i'm saying smile :lol:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Copying, Exploding or Changing Viewports in Model Space
« Reply #24 on: November 17, 2004, 02:07:56 PM »
Mark
Why don't you post your macro?
All you are looking for is to change the copied object to a pline, right?
Perhaps someone cod add that to YOUR macro?
Let's see it.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Copying, Exploding or Changing Viewports in Model Space
« Reply #25 on: November 17, 2004, 02:19:15 PM »
Just a little research and I found this:
Code: [Select]
;;; vp-outline.lsp
;;;
;;; Creates a polyline in modelspace that
;;; has the outline of the selected viewport.
;;; Supports clipped viewports.
;;; If vp-outline is called when in mspace it detects
;;; the active viewport.
;;;
;;; c:vp-outline
;;;
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com / http://jtbworld.vze.com
;;; E-mail: info@jtbworld.com / jtbworld@hotmail.com
;;;
;;; 2000-04-10
;;;
;;; Tested on AutoCAD 2000
;;; To do: support for drawing the outline in other ucs/view than world/current

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

(defun ax:List->VariantArray (lst)
  (vlax-Make-Variant
    (vlax-SafeArray-Fill
      (vlax-Make-SafeArray
        vlax-vbDouble
        (cons 0 (- (length lst) 1))
      )
      lst
    )
  )
)

(defun c:vp-outline (/ ad ss ent pl plist xy n vpbl vpur msbl msur ven vpno ok)
  (setq ad (vla-get-activedocument (vlax-get-acad-object)))
  (if (= (getvar "tilemode") 0)
    (progn
      (if (= (getvar "cvport") 1)
        (progn
          (if (setq ss (ssget ":E:S" '((0 . "VIEWPORT"))))
            (progn
              (setq ent (ssname ss 0))
              (setq vpno (dxf 69 (entget ent)))
              (vla-Display (vlax-ename->vla-object ent) :vlax-true)
              (vla-put-mspace ad :vlax-true) ; equal (command "._mspace")
              ; this to ensure trans later is working on correct viewport
              (setvar "cvport" vpno)
              (vla-put-mspace ad :vlax-false) ; equal (command "._pspace")
              (setq ok T)
            )
          )
        )
        (setq ent (vlax-vla-object->ename (vla-get-activepviewport ad))
              ok T
        )
      )
      (if ok
        (progn
          (setq ven (vlax-ename->vla-object ent))
          (if (/= 1 (logand 1 (dxf 90 (entget ent)))) ; detect perspective
            (if (= (vla-get-clipped ven) :vlax-false)
               (progn ; not clipped
                 (vla-getboundingbox ven 'vpbl 'vpur)
                 (setq msbl (trans (vlax-safearray->list vpbl) 3 2)
                       msur (trans (vlax-safearray->list vpur) 3 2)
                       plist (list (car msbl) (cadr msbl)
                                   (car msur) (cadr msbl)
                                   (car msur) (cadr msur)
                                   (car msbl) (cadr msur)
                             )
                 )
               )
               (progn ; clipped
                 (setq pl (entget (dxf 340 (entget ent)))
                       plist (vla-get-coordinates
                               (vlax-ename->vla-object (dxf -1 pl))
                             )
                       plist (vlax-safearray->list (vlax-variant-value plist))
                       n 0
                       pl nil
                 )
                 (repeat (/ (length plist) 2)
                   (setq xy (trans (list (nth n plist) (nth (1+ n) plist)) 3 2)
                         pl (cons (car xy) pl)
                         pl (cons (cadr xy) pl)
                         n (+ n 2)
                   )
                 )
                 (setq plist (reverse pl))
               )
            )
          )
          (setq plist (ax:List->VariantArray plist))
          (vla-Put-Closed
            (vla-AddLightWeightPolyline
              (vla-get-ModelSpace ad)
              plist
            )
            :vlax-True
          )
        )
      )
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #26 on: November 17, 2004, 04:16:27 PM »
is that similar to the vplim routine posted already or no cab?

ronjonp

  • Needs a day job
  • Posts: 7531
Copying, Exploding or Changing Viewports in Model Space
« Reply #27 on: November 17, 2004, 04:44:43 PM »
Quote
is that similar to the vplim routine posted already or no cab?


It is better  :D  It will work with polygon viewports as well. Great find CAB...I was just going to ask if anyone had a program like this.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ML

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #28 on: November 17, 2004, 06:16:03 PM »
OK CAB,

Here it is:

I did try the lisp routine above, it is real nice but this very simple macro will prompt you to pick your object, you pick your viewport, it copies it, it then tiles to model space and asks you for an insertion point, you can then pick a point, it scales the viewport up (in this case by 96 because our plot scale will be 1/8"=1') it makes, the current layer defpoints, it then pastes the viewport as a block, then layer 0 is made current. From there you can copy it around in model space. So, by putting the scale portion into the macro, we now have an overall limits that we can draw within in Model space for our viewport that we will plot from.

Now, if there was a way to make the viewport a polyline instead of a block in Model Space, I would be real happy.

Thanks

Mark

Code: [Select]

^C^Ccopyclip;\;(setvar "tilemode" 1);-layer;s;defpoints;;pasteblock;s;96;\(setvar 'clayer "0");
 

MikePerry

  • Guest
Copying, Exploding or Changing Viewports in Model Space
« Reply #29 on: November 17, 2004, 06:53:40 PM »
Quote from: ML
Now, if there was a way to make the viewport a polyline instead of a block in Model Space, I would be real happy.

Hi Mark

Did the following not work for you -

Change object layer color in Macro

Have a good one, Mike