Author Topic: CHPROP problem ...  (Read 6949 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~