Results 1 to 7 of 7

Thread: Test if viewport overlaps any text or linework

  1. #1
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Test if viewport overlaps any text or linework

    Is there a way to test if a viewport overlaps any text or linework? Sometimes when a detail is revised, part of the detail is extended out past the viewport and therefore can't see it. I would like to have the program run each time the drawing is plotted.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Test if viewport overlaps any text or linework

    Do you have all linework / text in Model Space always visible through a viewport? I.e. no temporary stuff around? Then it's possible to "extend" the viewport using some maths and properties like the viewport's Height, Width, Target & CustomScale. Then "summing" each MS entity's BoundingBox and seeing if any fall outside the viewport. Then it's probably possible to modify the viewport's Target, Width & Height to suit.

    If you have some entities outside the viewport's view (and you want to leave them there) it may be a bit difficult. I'd suggest having a border in MS which can be "linked" to some XData of the viewport, so that the VP gets adjusted to suit the border. You could always place the border on a non-plot layer.

    As for having it run each time you plot, it could be possible to "override" the plot command to do this first and then run the default plot. Otherwise (if you're using the border idea as above) an object reactor could be used which would adjust the viewport each time the border is modified.

  3. #3
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: Test if viewport overlaps any text or linework

    Usually there are other items outside the viewport that do not get shown in paperspace

  4. #4
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Test if viewport overlaps any text or linework

    In that case I'd advise going the Model Space border route. I can't see an easy way of doing it otherwise.

    In which case you're going to see a lot about working with viewport scales (converting from MS 1=1 to PS scale and back). As well as using reactors & storing xdata links between entities. But if you get this right, it means you've got an adjustable border in MS which "duplicates" itself in PS as a viewport.

    BTW, do you clip and/or rotate viewports? If so it's going to get really hairy .

    I'd like to help, but unfortunately I've not got much time . You could search this forum for several examples to show how to use reactors, how to set & get xdata and how to convert points to-and-from PS & MS.

  5. #5
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: Test if viewport overlaps any text or linework

    I sometimes clip and rotate viewports. It sounds like this might be very difficult. I will experiment with a few things and post if I come up with anything.

  6. #6
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

    Default Re: Test if viewport overlaps any text or linework

    Irneb,

    I am trying something that will work for viewports that are not rotated or clipped but I can' t figure out how to translate paperspace coordinates to modelspace coordinates.

    How do you use the TRANS function to translate points PS to MS?


    Code:
    (defun rtd (a) (* (/ a pi) 180.0))
    
    (defun dtr (a) (* (/ a 180.0) pi))
    
    (defun c:vp_overlap (/ vp)
          (initerr)
          (setq vp (entget (car (entsel "\nSelect Viewport: "))))
          (setq vp_cp (cdr (assoc 10 vp)))
          (setq vp_w (cdr (assoc 40 vp)))
          (setq vp_h (cdr (assoc 41 vp)))
    
          (setq pt1 (polar (polar vp_cp (dtr 90) (/ vp_h 2)) (dtr 180) (/ vp_w 2)))
          (setq pt2 (polar (polar vp_cp (dtr 90) (/ vp_h 2)) (dtr 0) (/ vp_w 2)))
          (setq pt3 (polar (polar vp_cp (dtr 270) (/ vp_h 2)) (dtr 0) (/ vp_w 2)))
          (setq pt4 (polar (polar vp_cp (dtr 270) (/ vp_h 2)) (dtr 180) (/ vp_w 2)))
    
         (setq pt1 (trans pt1 2 0))
          (setq pt2 (trans pt2 2 0))
          (setq pt3 (trans pt3 3 2))
          (setq pt4 (trans pt4 3 2))
    
          (reset)
          (princ)
          )
    (princ)

  7. #7
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Test if viewport overlaps any text or linework

    This should help:
    http://www.jtbworld.com/lisp/vp-outline.htm

    and this:
    Code:
    (vlax-invoke Object1 'IntersectWith Object2 acExtendNoNe)

Similar Threads

  1. Non-printable text and linework for reviewing
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2008-02-04, 10:50 PM
  2. Text looks fine in DWF, but! when the DWF is plotted the test misbehaves
    By drafting1 in forum Design Review - General
    Replies: 3
    Last Post: 2007-04-23, 06:10 PM
  3. Convert linework/text into a table
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2006-08-08, 04:58 PM
  4. LINEWORK/IMAGE/VIEWPORT DRAWORDER
    By AutoCAD Vancouver in forum AutoCAD Plotting
    Replies: 3
    Last Post: 2005-10-24, 03:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •