Author Topic: Pulling information from a Field  (Read 8183 times)

0 Members and 1 Guest are viewing this topic.

Krushert

  • Seagull
  • Posts: 13581
  • FREE BEER Tomorrow!!
Re: Pulling information from a Field
« Reply #45 on: July 14, 2006, 03:41:58 PM »
Okay this is what I am getting so far with "this" code.  clunky I know.

Tim your dotted pair threw me for a loop.  minor loop was the "x".  Then major one was the 410 & ctab variable.  I could not work it in.  If the current tab was 3rd tab of (3) layout tabs it return the first tab.  So I am came up with this. 

Code: [Select]
(setq ss1
       (ssget "_x"
      (list
(cons 0 "MTEXT")
(CONS 8 "TITLE-BLOCK-TEXT")
(cons 410 (getvar "ctab"))
      )
       )
)


  (setq ss2
       (ssget "p"
      '(
(-4 . "<OR")
(7 . "helv-meds-19")
(7 . "helv14")
(-4 . "OR>")
       )
       )
)
 
(setq txt (cdr (assoc 1 (entget (ssname ss2 0)))))
(setq dwg# (strip_text txt)) ;;Mtext Formating Code Stripper
)

Hey it works, until I go to the other Principal's title block with "helv14".  It crashes and returns this at the command line.
Quote
Command: bad argument type: lselsetp nil
« Last Edit: July 14, 2006, 03:55:33 PM by Krushert »
I + XI = X is true ...
... if you change your perspective.

Krushert

  • Seagull
  • Posts: 13581
  • FREE BEER Tomorrow!!
Re: Pulling information from a Field
« Reply #46 on: July 14, 2006, 03:43:59 PM »
Why not?
Code: [Select]
(cons 7 "helv-meds-19,helv14")
I thought about that, but then I thought it wouldn't work for some strange reason.  It has been a weird day at work for me.

I tried that earlier but it crashed.  I will try it again with your formating. Maybe I didn't have it quite right.
I + XI = X is true ...
... if you change your perspective.

Krushert

  • Seagull
  • Posts: 13581
  • FREE BEER Tomorrow!!
Re: Pulling information from a Field
« Reply #47 on: July 14, 2006, 03:54:57 PM »
Why not?
Code: [Select]
(cons 7 "helv-meds-19,helv14")
I thought about that, but then I thought it wouldn't work for some strange reason.  It has been a weird day at work for me.

I tried that earlier but it crashed.  I will try it again with your formating. Maybe I didn't have it quite right.

Okay it work in the  "helv-meds-19" title block but not in the "helv14" title block.  Bck to find to why not.  I know it worked earlier.  I think. :? :? :?
I + XI = X is true ...
... if you change your perspective.

T.Willey

  • Needs a day job
  • Posts: 5218
Re: Pulling information from a Field
« Reply #48 on: July 14, 2006, 03:57:02 PM »
These two should be in on ssget filter.
Code: [Select]
(setq ss1
       (ssget "_x"
      (list
(cons 0 "MTEXT")
(CONS 8 "TITLE-BLOCK-TEXT")
(cons 410 (getvar "ctab"))
      )
       )
)


  (setq ss2
       (ssget "p"
      '(
(-4 . "<OR")
(7 . "helv-meds-19")
(7 . "helv14")
(-4 . "OR>")
       )
       )
)
Would look like.
Code: [Select]
(setq ss1
       (ssget "_x"
      (list
(cons 0 "MTEXT")
(CONS 8 "TITLE-BLOCK-TEXT")
(cons 410 (getvar "ctab"))
'(-4 . "<OR")
'(7 . "helv-meds-19")
'(7 . "helv14")
'(-4 . "OR>")
       )
       )
)
or
Code: [Select]
(setq ss1
       (ssget "_x"
      (list
(cons 0 "MTEXT")
(CONS 8 "TITLE-BLOCK-TEXT")
(cons 410 (getvar "ctab"))
(cons -4  "<OR")
(cons 7  "helv-meds-19")
(cons 7  "helv14")
(cons -4  "OR>")
       )
       )
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13581
  • FREE BEER Tomorrow!!
Re: Pulling information from a Field
« Reply #49 on: July 14, 2006, 04:19:20 PM »
Code: [Select]
(setq ss1
       (ssget "_x"
      (list
(cons 0 "MTEXT")
(CONS 8 "TITLE-BLOCK-TEXT")
(cons 410 (getvar "ctab"))
(cons -4  "<OR")
(cons 7  "helv-meds-19")
(cons 7  "helv14")
(cons -4  "OR>")
       )
       ))

I took the latter option. And it still did not work in the "helv14" TB.

That is because the style name is "HELV14" not "helv14"  :x :x  Computers just got to love them  :-)
I + XI = X is true ...
... if you change your perspective.

Krushert

  • Seagull
  • Posts: 13581
  • FREE BEER Tomorrow!!
Re: Pulling information from a Field
« Reply #50 on: July 14, 2006, 04:32:43 PM »
I have tested it on a bunch of drawings and it seems to work.
Thanks Guys for helping me out and letting me ahhh barrow <cough "steal"> your code.
I will plunk it to main routine come Monday and see how it plays out.  I will post it later.
I hope it was not too painful  :-)
Have a good weekend.
Thanks.
I + XI = X is true ...
... if you change your perspective.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10376
Re: Pulling information from a Field
« Reply #51 on: July 14, 2006, 05:28:12 PM »
Glad you have some workable code to play with.

In my test, ACAD2000, the dxf 7 did not care if the case did not match.

This get nothing?
Code: [Select]
(setq ss (ssget "X" '((0 . "MTEXT")(7 . "helv14"))))
BTW you can also do you code this way, just FYI.

Code: [Select]
(setq ss1
       (ssget "_x"
      (list
'(0 . "MTEXT")
'(8 . "TITLE-BLOCK-TEXT")
(cons 410 (getvar "ctab"))
'(-4 . "<OR")
'(7  . "helv-meds-19")
'(7  . "helv14")
'(-4 . "OR>")
       )
       ))
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.