Author Topic: Freezing layers in a current viewport  (Read 4918 times)

0 Members and 1 Guest are viewing this topic.

Columbia

  • Guest
Freezing layers in a current viewport
« on: August 06, 2004, 09:29:47 AM »
Alright people,

I need to be beat over the head a little because for some reason I can't get this little test program to work.  I'm trying to add a layer to a paperspace viewport entity list so that it becomes frozen in the current viewport only.

The layer "CENTERLINE" exists in the drawing already.

Any help with this code would be most appreciated...
Code: [Select]

(vl-load-com)
(defun c:test (/ ename layer elist)
  (setq ename (car (entsel "\nPick ViewPort..."))
        layer (vlax-vla-object->ename
                (vla-item
                  (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
                  "CENTERLINE"
                )
              )
         elist (entget ename)
         elist (append elist (list (cons 331 layer)))
  )
  (entmod elist)
  (entupd ename)
)

JohnK

  • Administrator
  • Seagull
  • Posts: 10642
Freezing layers in a current viewport
« Reply #1 on: August 06, 2004, 09:39:15 AM »
Im not really sure i understand what your trying to do exaclty, but if you try using "vla-add" instead of "vla-item" would that do what you want?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10642
Freezing layers in a current viewport
« Reply #2 on: August 06, 2004, 09:42:32 AM »
...nevermind, i think i see what your trying to do.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10642
Freezing layers in a current viewport
« Reply #3 on: August 06, 2004, 09:46:15 AM »
Heres a snip from the help docs
Quote

Restrictions on Using entmod

There are restrictions on the changes the entmod function can make:

An entity's type and handle cannot be changed. If you want to do this, use  entdel to delete the entity, then make a new entity with the command or entmake functions.
   The entmod function cannot change internal fields such as the entity name in the –2 group of a seqend entity—attempts to change such fields are ignored.
   You cannot use the entmod function to modify a viewport entity.


***DARNIT! (I hit the button to fast)

Did that help?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Columbia

  • Guest
Freezing layers in a current viewport
« Reply #4 on: August 06, 2004, 09:52:28 AM »
Yeah, that explains why the snippet doesn't work.  But that leads me to the next question...

How the HE$$ are you supposed to freeze layers in the current viewport if there is no other method other than the (command) call??

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Freezing layers in a current viewport
« Reply #5 on: August 06, 2004, 10:05:07 AM »
<guess>Have you tried vla-setxdata and vla-update on the viewport object?</guess>
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Columbia

  • Guest
Freezing layers in a current viewport
« Reply #6 on: August 06, 2004, 10:50:54 AM »
No, I haven't.  But only because I don't think the layer names/handles/IDs were attached as XDATA.

If they are what APP are they listed under?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
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.

Columbia

  • Guest
Freezing layers in a current viewport
« Reply #8 on: August 06, 2004, 12:05:30 PM »
A little...

I guess the short answer to this is:
You have to use (command "._vplayer") to do what I want it to do.  There is no other method available to the VLISP world.  :cry:

Thanks guys for showing me the futility in what I was trying to do.   Maybe I'll go find a tall bridge, and leave my parachute at home...

daron

  • Guest
Freezing layers in a current viewport
« Reply #9 on: August 06, 2004, 01:15:58 PM »
It's funny that this:
Quote
70 Standard flags (bit-coded values):
1 = Layer is frozen; otherwise layer is thawed
2 = Layer is frozen by default in new viewports
4 = Layer is locked
16 = If set, table entry is externally dependent on an xref
32 = If this bit and bit 16 are both set, the externally dependent xref has been successfully resolved
64 = If set, the table entry was referenced by at least one entity in the drawing the last time the drawing was edited. (This flag is for the benefit of AutoCAD commands. It can be ignored by most programs that read DXF files and need not be set by programs that write DXF files)

doesn't say anything about what you are after. I see that bit code 2 talks about new viewports, but nothing about the state of a layer frozen in a viewport. That or I'm just not seeing it. I've just learned how limiting layer states can be too. They seem to have the same limitation. They work in modelspace and if the new vp freeze is active or not, but don't work in paperspace otherwise, if at all.