Author Topic: CHPROP problem ...  (Read 6948 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
CHPROP problem ...
« on: February 23, 2007, 04:39:40 PM »
Code: [Select]
        (setq LayrTitl (ssget "X" '((8 . "TITLE"))))
        (if (/= LayrTitl nil)
          (command ".CHPROP" LayrTitl "" "LAyer" "S-Title" "")
        )
     

Why would this error out when the 'LayrTitl' is nil ??

Quote
(setq LayrTitl (ssget "X" '((8 . "TITLE"))))
<Selection set: 5f>
(if (/= LayerTitl nil)(command ".CHPROP" LayerTitl "" "LAyer" "S-Title" ""))
Error: Function cancelled
; error: An error has occurred inside the *error* functionFunction cancelled
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

uncoolperson

  • Guest
Re: CHPROP problem ...
« Reply #1 on: February 23, 2007, 04:47:02 PM »
Code: [Select]
        (setq LayrTitl (ssget "X" '((8 . "TITLE"))))
        (if (/= LayrTitl nil)
          (command ".CHPROP" LayrTitl "" "LAyer" "S-Title" "")
        )
     

Why would this error out when the 'LayrTitl' is nil ??

Quote
(setq LayrTitl (ssget "X" '((8 . "TITLE"))))
<Selection set: 5f>
(if (/= LayerTitl nil)(command ".CHPROP" LayerTitl "" "LAyer" "S-Title" ""))
Error: Function cancelled
; error: An error has occurred inside the *error* functionFunction cancelled

correct me if i'm wrong, but by this returning something other that nil, it's LayerTitl isn't nil...
Code: [Select]
(setq LayrTitl (ssget "X" '((8 . "TITLE"))))
<Selection set: 5f>

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #2 on: February 23, 2007, 04:57:30 PM »
  ...
Why would this error out when the 'LayrTitl' is nil ??
  ...

correct me if i'm wrong, but by this returning something other that nil, it's LayerTitl isn't nil...
Code: [Select]
(setq LayrTitl (ssget "X" '((8 . "TITLE"))))
<Selection set: 5f>
[/quote]

You are correct, If there is nothing selected, 'LayrTitl' should come back with 'nil', not a selection set.
But I think we found the problem.
The Selection set is valid, but the items are "not in current space", meaning they are in the Paper space.  Doht.

Hey, Thanks for the help.   :-)
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #3 on: February 23, 2007, 05:04:36 PM »
ok, there was a topic about this sort of problem, and someone suggested a piece of code that would check both mspace and pspace.  It basically fixed this problem where "2 items are not in current space" error.
Does anyone know where that topic is at ??  I can't find it now that I'm looking for it.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

efernal

  • Bull Frog
  • Posts: 206
Re: CHPROP problem ...
« Reply #4 on: February 23, 2007, 05:17:18 PM »
Code: [Select]
(IF (SETQ ss (SSGET "X" '((8 . "TITLE"))))
  (PROGN (IF (NULL (TBLSEARCH "LAYER" "S-Title"))
           (ENTMAKEX '((0 . "LAYER")
                       (100 . "AcDbSymbolTableRecord")
                       (100 . "AcDbLayerTableRecord")
                       (2 . "S-Title")
                       (70 . 0)
                       (62 . 7)
                       (6 . "Continuous")
                       (290 . 1)
                       (370 . -3)
                      )
           )
         )
         (COMMAND ".CHPROP" ss "" "LAyer" "S-Title" "")
  )
  nil
)
e.fernal

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #5 on: February 23, 2007, 05:28:32 PM »
Oh Man, ... introducing another control to me "entmakex" ... that's dangerous.   I don't have time for all this at the moment, the pressure is on.

I was hoping for something along the lines of this piece.
Code: [Select]
((setq sset (ssget "X" '((0 . "LAYER") [color=red](67 . 1)[/color])))

I found this while doing a search.  Would this piece in red force the 'ssget' to grab everything in just the model space ??
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #6 on: February 23, 2007, 05:48:18 PM »
How about you test it and let us know  ;-)
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.

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #7 on: February 23, 2007, 05:58:59 PM »
How about you test it and let us know  ;-)

Already did.  Sorry, I'm in a bit of a rush.  I'm being harrassed by too many people at the moment to think straight.

I'm not sure that I put it in correctly, It errored on me.  I've got to play with it more.  here's what I'm trying to do.
Code: [Select]
    (if (tblsearch "layer" "TITLE")
      (progn
        (if (not (tblsearch "layer" "S-Title"))
          (command ".-layer" "New" "S-Title" "Color" "1" "S-Title" ""))
        (setq LayrTitl (ssget "X" '((8 . "TITLE") (67 . 1))))
        (if (/= LayerTitl nil)
          (command ".CHPROP" LayerTitl "" "LAyer" "S-Title" ""))))

Here's another question though, the ".chprop" doesn't change properties across another space, is there another way to take the stuff on both the pspace and mspace and change it over to the new layer ??
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #8 on: February 23, 2007, 06:21:18 PM »

.....................
Code: [Select]
((setq sset (ssget "X" '((0 . "LAYER") [color=red](67 . 1)[/color])))

I found this while doing a search.  Would this piece in red force the 'ssget' to grab everything in just the model space ??


Group code 76 is optional and defaults to 0 . If absent or zero indicates entity is in model space. 1 indicates entity is in paper space.

... so the answer is no.

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.

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #9 on: February 23, 2007, 06:26:07 PM »
Doht !!!  I'm such an idiot !!!

How about you test it and let us know  ;-)

Already did.  Sorry, I'm in a bit of a rush.  I'm being harrassed by too many people at the moment to think straight.

I'm not sure that I put it in correctly, It errored on me.  I've got to play with it more.  here's what I'm trying to do.

Sorry again, I'm in too much of a rush.
(Anybody know Brian Regan ??  Excellent stand-up comedian)   I need to microwave my pop tarts !!

Ok, I got it to work.  Very nice.  Thank you guys again for your help.

.....................
Code: [Select]
((setq sset (ssget "X" '((0 . "LAYER") [color=red](67 . 1)[/color])))
I found this while doing a search.  Would this piece in red force the 'ssget' to grab everything in just the model space ??

Group code 76 is optional and defaults to 0 . If absent or zero indicates entity is in model space. 1 indicates entity is in paper space.

... so the answer is no.


Thank you Kerry.  I just barely caught that a second ago, but it's good to have confirmation from a guru like yourself.   :wink:

Man, I have GOT to slow down !!

I'm still curious though, is there another way to take the stuff selected on both the pspace AND mspace and change it over to the new layer all at once ??
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #10 on: February 23, 2007, 06:32:51 PM »
but .... what is this

(0 . "LAYER")
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.

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #11 on: February 23, 2007, 06:40:11 PM »
but .... what is this

(0 . "LAYER")
It was just an example from a post I was searching on, doesn't mean a thing here.

 ...

GRRRRRRRR ...  Once again, I'm not thinking this through.
Lemme see if I understand this:
Quote
(IF (SETQ ss (SSGET "X" '((8 . "TITLE"))))                 ;Selecting everything in the drawing on layer title
  (PROGN (IF (NULL (TBLSEARCH "LAYER" "S-Title"))    ;If the layer "S-Title" doesn't exist,
           (ENTMAKEX '((0 . "LAYER")                          ;Make a Layer
                       (100 . "AcDbSymbolTableRecord")     ; I don't know this
                       (100 . "AcDbLayerTableRecord")       ; I don't know this
                       (2 . "S-Title")                               ;Name the layer "S-Title"
                       (70 . 0)                                       ; Dimension ??
                       (62 . 7)                                       ;Color - White
                       (6 . "Continuous")                          ;Linetype "Continuous"
                       (290 . 1)                                      ; I don't know this
                       (370 . -3)                                     ; I don't know this
                      )
           )
         )
         (COMMAND ".CHPROP" ss "" "LAyer" "S-Title" "")  ;Change properties of selection to layer "S-Title"
  )
  nil
)

So this creates the layer, but will it move everything from both the Model & Paper space to the new layer ??



Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #12 on: February 23, 2007, 06:46:54 PM »

Code: [Select]
(setq sset (ssget "X" '((8 . "LAYER") )))

(setq sset-1 (ssget "X" '((8 . "LAYER") (67 . 1))))

(setq sset-0 (ssget "X" '((8 . "LAYER") (67 . 0))))


Try this on layer "LAYER"
Draw 3 lines in Modelspace
1 circle in Paperspace

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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #13 on: February 23, 2007, 07:45:28 PM »


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.

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #14 on: February 23, 2007, 08:07:08 PM »
Sorry about the delay in response, I was doing a little 'dicto' drafting with an engineer.

The Inspect button.  Good for checking the outcome of a command.  So that's how you guys check code so dang'd fast.
Well, one of many I'm sure. 
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hangman

  • Swamp Rat
  • Posts: 566
Re: CHPROP problem ...
« Reply #15 on: February 23, 2007, 08:15:31 PM »
That's a very good example.  I appreciate you showing me how to check my code so I don't have to be asking you all these stupid questions.  I feel quite stupid asking some of these questions 'cause I know the solution is quite simple, but I don't know how they are done.
It's frustrating for you guys I know, and there are area's that I just have no idea of what is going on to base an intelligent question to you.  So again, I say Thank you for your patience and help in working with me with these questions.

For now, I must go do homework.  I'll stop back in Monday, have a good weekend.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

efernal

  • Bull Frog
  • Posts: 206
Re: CHPROP problem ...
« Reply #16 on: February 23, 2007, 08:25:51 PM »
Code: [Select]
The following group codes apply to LAYER symbol table entries. In addition to the group codes described here, see "Common Group Codes for Symbol Table Entries." For information about abbreviations and formatting used in this table, see "Formatting Conventions in This Reference."

LAYER group codes

Group code Description
100 Subclass marker (AcDbLayerTableRecord)
2 Layer name
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.)
62 Color number (if negative, layer is off)
6 Linetype name
290 Plotting flag. If set to 0, do not plot this layer
370 Lineweight enum value
390 Hard pointer ID/handle of PlotStyleName object
 

Xref-dependent layers are output during SAVEAS. For these layers, the associated linetype name in the DXF file is always CONTINUOUS.
e.fernal

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #17 on: February 23, 2007, 08:29:20 PM »
You and others may find this helpfull too ...
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.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: CHPROP problem ...
« Reply #18 on: February 23, 2007, 08:47:16 PM »
To answer the other question:
Quote
I'm still curious though, is there another way to take the stuff selected on both the pspace AND mspace and change it over to the new layer all at once ??
Yes. Replace the entire "chprop" line with this:
Code: [Select]
         ;(COMMAND ".CHPROP" ss "" "LAyer" "S-Title" "")  ;;no longer needed
    (while (setq ent (ssname ss 0));Change properties of selection to layer "S-Title"
      (setq elist (entget ent))
      (setq elist (subst '(8 . "S-Title") (assoc 8 elist) elist))
      (entmod elist)
      (ssdel ent ss)
      )     
This will work for most entities. PS viewports will not be changed since you cannot (entmod) a VP.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: CHPROP problem ...
« Reply #19 on: February 23, 2007, 08:49:19 PM »
Kerry,
What's the program you use to capture the screen? I know it's been posted before, but I'm a moron and don't write this stuff down where I can find it.

Thanks

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: CHPROP problem ...
« Reply #20 on: February 23, 2007, 09:26:29 PM »
Hi Jeff


for the still Piccys :
SnagIt Screen Capture and Sharing $39.95 per copy

for the Video :
Camtasia Studio Screen Recording and Presentation $299.00 per copy

SnagIt and Camtasia Studio Bundle $319.00 per copy


http://www.techsmith.com/default.asp?


These are saved as GIF files. The preferred for presentation is an AVI Video < which is a little big for posting> or Flash (SWF/FLV) or WMV
« Last Edit: February 23, 2007, 09:32:30 PM by Kerry Brown »
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.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: CHPROP problem ...
« Reply #21 on: February 23, 2007, 10:19:26 PM »
Thank you sir. I've now bookmarked that page.