Author Topic: Renumerating  (Read 12238 times)

0 Members and 1 Guest are viewing this topic.

deegeecees

  • Guest
Renumerating
« Reply #15 on: January 05, 2004, 02:35:02 PM »
So, my spelling aint so good, umm, yes, what is your operating status Mr. Water Bear?

AutoCAD version?
Operating System?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Renumerating
« Reply #16 on: January 05, 2004, 02:39:05 PM »
Perhaps something like this would suit ?

kwb

Code: [Select]

(defun nextductid (/ returnvalue)
  (or #cnt (setq #cnt (getcfg "appdata/MySTUFF/LastDuctID")))
  (or (and #cnt (/= 0 (strlen #cnt)))
      (setq returnvalue (getint "No Duct Number has been saved. Enter New Number :"
                        )
            returnvalue (if (= returnvalue "")
                          000
                          (1- returnvalue)
                        )
      )
     
  )
  (if (numberp returnvalue)
    (setq #cnt (itoa(1+ returnvalue)))
    (setq #cnt (itoa(1+ (atoi #cnt))))  
  )    
  (setcfg "appdata/MySTUFF/LastDuctID" #cnt)
  #cnt
)

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Renumerating
« Reply #17 on: January 05, 2004, 02:42:24 PM »
Kerry, I actually had thought of using that scenario, but if there are multiple drawings, the duct number would be incorrect in a different drawing. I suggest using the system variable USERI1 to store the number since it is an integer and is stored in the drawing when it is saved.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

deegeecees

  • Guest
Renumerating
« Reply #18 on: January 05, 2004, 02:43:47 PM »
Oh, sure just give him the whole farm. How will people ever learn to be responsible Lispers if they never learn on their own?

Keb, if another routine uses the USER??? variables when a drawing is opened, he's not going to aquire the correct info from it. The CORRECT way would be the sort through method.

Water Bear

  • Guest
kudos...
« Reply #19 on: January 05, 2004, 02:43:54 PM »
DGCs..thanx, let me work on the ssget "x"
p.s. I noticed right away KEB wuz pulling a chain...hater!

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Renumerating
« Reply #20 on: January 05, 2004, 02:46:49 PM »
Huh????I aint pullin no ones chain....I aint got no hands....If'n ya don't want to just replace yer cnt code with my edited one that's fine cuz I just like to code....

an wazzup with hater????
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Renumerating
« Reply #21 on: January 05, 2004, 02:47:16 PM »
Perhaps this then

(setcfg (strcat "appdata/MySTUFF/" (getvar "dwgname") "/LastDuctID") "123")
(getcfg (strcat "appdata/MySTUFF/" (getvar "dwgname") "/LastDuctID"))

< added >
Keith ... its just that I loath the "USERxxx" vars :)
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

daron

  • Guest
Renumerating
« Reply #22 on: January 05, 2004, 02:52:05 PM »
Quote from: KEB
Huh????I aint pullin no ones chain....I aint got no hands....If'n ya don't want to just replace yer cnt code with my edited one that's fine cuz I just like to code....

an wazzup with hater????


I was wondering the same thing. Guy don't know what he's talking about, I think.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Renumerating
« Reply #23 on: January 05, 2004, 03:19:18 PM »
Ok, Kerry ... just being the devils advocate for a minute.. what happens when he has edited like a thousand drawings....the acad.cfg gets HUGE, plus the drawing cannot be edited across machines effectively...

If you don't like USERxx variables that is ok.. I was simply trying to offer the simplest solution to the problem..

But...
We can still have an internal count (internal to the drawing) that is editable by the program across multiple edits and on different machines at the same time...

Code: [Select]

(defun CNT ()
  (vl-load-com) ; per the Daron Act
  (if #CNT
     nil
     (if (not(setq #CNT (vlax-ldata-get "DuctCount" "CNT")))
         (setq #CNT 0)
     )
  )
  (setq #CNT (1+ #CNT))
  (vlax-ldata-put "DuctCount" "CNT" #CNT)
  (princ)
  )


Now how is that.....totally portable, usable on R2000+, no external files and simple.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Water Bear

  • Guest
my bad..
« Reply #24 on: January 05, 2004, 03:25:03 PM »
Sorry if I step on any toes..I thought someone was INTENTIONALLY misdirecting me because of inconstistent "USERI1" variables...but the post has since been corrected..my bad, I should have known it was an innocent typo! my apologies to KEB

DGCs:2k4 XP

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Renumerating
« Reply #25 on: January 05, 2004, 03:31:01 PM »
Keith :: Yep that works cool.

what's that expression about  lots of ways to pluck a duck :D

An effective solution depends on the project requirements, which we dont know of course.

Personally I would use attributed blocks, then a search is easier, and so is renumbering if you have to.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Water Bear

  • Guest
humm...
« Reply #26 on: January 05, 2004, 03:54:32 PM »
KerryB
That sounds like an interesting alternative (attributes) how would I setup to re-number? What function could I use?

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9673
Renumerating
« Reply #27 on: January 05, 2004, 04:03:53 PM »
I like ldata. (I always forget about it too!) I like the idea of an external file, but thats cool. whatever works.
TheSwamp.org (serving the CAD community since 2003)

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16867
  • Superior Stupidity at its best
Renumerating
« Reply #28 on: January 05, 2004, 04:03:56 PM »
Quote
how would I setup to re-number? What function could I use?

WB, you would need to use attributed blocks for your numbering scheme, even if it is simply a single attribute with no other objects. You could then filter for the block name and each one would have a unique number. Once the selection of the blocks is completed, you would simply need to use other routines available from this site to update and/or change the numbering.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

deegeecees

  • Guest
Another Duck
« Reply #29 on: January 05, 2004, 04:31:56 PM »
How about using xdata. Attach xtended entity data to the entities in question. If they are text entities all the better, just find em and manipulate em.

Quack.