+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Junior Member
    Using
    Inventor 2008
    Join Date
    Jul 2008
    Posts
    18

    Default XData to Viewport?

    Registered forum members do not see this ad.

    Has anybody ever attached (succefully) any custom extended entity data to a viewport?

    I looked in the sources from the Express Utilities and there are one utility Layoutmerge.lsp (unfortunately doesn't work well in Acad2009 ) where they attach xdata and after completition of the operation delete it. I halt the program before the delete, but beside standard xdata 'ACAD' there was nothing else.
    Beside this if you try to merge layouts with more than one vieport and Autocad 2009 crashes with
    INTERNAL ERROR: !dbobji.cpp@6861: eNotOpenForWrite

    From lisp documentation is written that entmod doesn't work with vieport objects. I cant find such written memo for SetXdata and tried it, but with no sucess.

  2. #2
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    You cannot attach XData to Viewport

    There is ACAD data (xroom - shows empty XData):

    Code:
    (-3 (ACAD (1000 . MVIEW) (1002 . {) (1070 . 16) (1010 0.0 0.0 0.0) (1010 0.0 
    0.0 1.0) (1040 . 0.0) (1040 . 321.628) (1040 . 210.0) (1040 . 148.5) (1040 . 
    50.0) (1040 . 0.0) (1040 . 0.0) (1070 . 0) (1070 . 1000) (1070 . 1) (1070 . 3) 
    (1070 . 0) (1070 . 0) (1070 . 0) (1070 . 0) (1040 . 0.0) (1040 . 0.0) (1040 . 
    0.0) (1040 . 10.0) (1040 . 10.0) (1040 . 10.0) (1040 . 10.0) (1070 . 0) (1002 . 
    {) (1002 . }) (1002 . })))
    Find other place to attach it because Viewport don't allow to make it. Never.

  3. #3
    Senior Member
    Using
    not applicable
    Join Date
    May 2007
    Posts
    126

    Default

    it looks like you are still trying to pan the viewport without (command)
    this code will set the model center (dxf code 12) to 0,0
    Code:
    (progn (vl-load-com)
           (setq EntName (car (entsel "\nSelect viewport: ")))
           (vla-GetXData
    	 (vlax-ename->vla-object EntName)
    	 "ACAD"
    	 'XDataType
    	 'XDataValue
           )
           (vlax-safearray-put-element XDataValue 8 0.0)
           (vlax-safearray-put-element XDataValue 9 0.0)
           (vla-SetXData
    	 (vlax-ename->vla-object EntName)
    	 XDataType
    	 XDataValue
           )
    ;;;ensure that xdata is changed
           (vla-GetXData
    	 (vlax-ename->vla-object EntName)
    	 "ACAD"
    	 'XDataType
    	 'XDataValue
           )
           (vlax-safearray-get-element XDataValue 8)
           (vlax-safearray-get-element XDataValue 9)
    )
    the bad thing is that acad doesn't care of what you set the vieport's xdata to

  4. #4
    Junior Member
    Using
    Inventor 2008
    Join Date
    Jul 2008
    Posts
    18

    Default

    Quote Originally Posted by VovKa View Post
    it looks like you are still trying to pan the viewport without (command)
    this code will set the model center (dxf code 12) to 0,0

    the bad thing is that acad doesn't care of what you set the vieport's xdata to
    Ah, no I already find a way to make the "pan"
    Code:
    (vl-load-com)
    (defun set_vpoint (vp_ename view_pt customscale1 / dwg vp1 )
    ; sets new viewpoint center and zoom\scale for a papare space viewport
    ; view_pt is in DCS coordinate system (those returned from DXF 12)
     (setq vp1 (vlax-ename->vla-object vp_ename))
     (setq dwg (vla-get-ActiveDocument (vlax-get-acad-object)))
     (vla-Display vp1 :vlax-true)
     ; Activate a view port.
     (vla-put-mspace Dwg :vlax-true)
     ; Set the new view port as the active view port.
     (vla-put-activepviewport Dwg vp1)
     ; Zoom to the required location.
     (vla-zoomcenter (vlax-get-acad-object) (vlax-3d-point (trans view_pt 2 0)) 1)
     ; Deactivate the view port (jump back to paper space).
     (vla-put-mspace Dwg :vlax-false)
     ; Set the scale.
     (vla-put-StandardScale vp1 1)
     (vla-put-customscale Vp1 customscale1)
     ; (princ)
     
    ) ;set_vpoint

    I also tried similar code like yours to change existing Xdata for a viewport, but after you call again entget you'll see that nothing changed from the original entget list

    This with the viewport is another issue I'm trying to resolve and the best way was to attach some my custom xdata to the viewports, so can make templates that can further use and know exactly which port for what is dedicated.
    Yesterday when found the source of the layoutmerge.lsp which comes with the Autocad (Express tools folder) and I thought that probably there is a way to attach data to a viewport - anyway the source originates from Autodesk, but it also doen't work
    Last edited by bestplace2; 7th Aug 2008 at 12:32 pm.

  5. #5
    Junior Member
    Using
    Inventor 2008
    Join Date
    Jul 2008
    Posts
    18

    Default

    Quote Originally Posted by ASMI View Post
    You cannot attach XData to Viewport
    Find other place to attach it because Viewport don't allow to make it. Never.
    Still looking, but haven't any better idea than to attach xdata to the viewport. Eventually could use the Hyperlink property to add some information, but not so good as xdata 'cause Ctrl + Click activates the Hyperlink (which in my case will not be an actual hyperlink)

  6. #6
    Senior Member
    Using
    not applicable
    Join Date
    May 2007
    Posts
    126

    Default

    Registered forum members do not see this ad.

    have you tried vlax-ldata- functions?

Similar Threads

  1. Viewport Help
    By east§ide in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 26th Oct 2007, 10:18 pm
  2. Viewport within a viewport
    By kippax in forum AutoCAD Beginners' Area
    Replies: 9
    Last Post: 26th Sep 2007, 12:37 pm
  3. Replies: 2
    Last Post: 14th Jul 2006, 05:24 pm
  4. Selecting a viewport within a bigger viewport
    By edwin in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 16th Nov 2005, 06:13 pm

Bookmarks

Posting Permissions

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