Author Topic: Make Sheet Index using obectDBX  (Read 68881 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #45 on: February 11, 2006, 10:36:19 AM »
Allen

Thanks. I think your on the right track, don't know why it stops.

(ARCH:CreateIndex '(("2436TBA" "A-01" "SHT_TTL")("IAADD" "XX" "X")))

Command: (ARCH:CreateIndex '(("2436TBA" "A-01" "SHT_TTL")("IAADD" "XX" "X")))
; error: bad argument type: stringp (("SHT_TTL" . "Cover") ("A-01" . "A0.00"))

Will play with it at home. I'm out to.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #46 on: February 11, 2006, 11:04:20 AM »
Allen

YES, THANK YOU. I got the following to work. Now it's back to recompiling the list.

Code: [Select]
(defun ARCH:CreateIndex (lst / indexlist file)
  (setq indexlist (getindex lst))
  (if (member "acetutil.arx" (arx))(ACET-UI-PROGRESS-DONE)) ;;added progress bar finish
  ;|
  (setq file (open "C:\\Temp\\SheetIndex.txt" "w"))
  (repeat
    (length indexlist)
    (setq a (car indexlist) indexlist (cdr indexlist))
    (write-line (strcat (car a) "\t" (cdr a)) file)
  )
  (close file)
  (command ".shell" "notepad C:\\Temp\\SheetIndex.txt")
  |;
  (princ indexlist)
)


I did a small test on one drawing that has both blocks and this is the result:
Block one is 2436TBA .....this is the sheet attribute which contains sheet number and name
Block two is IRREV .........this is revison delta with revision number and date

(ARCH:CreateIndex '(("2436TBA"
"A-01" "SHT_TTL")("IRREV" "XX" "X")))
((((XX . 20 May 2002) (X . 2))))(((("XX" . "20 May 2002") ("X" . "2"))))

So, now its back to working with the resulting list, and making the following work:

(repeat
    (length indexlist)
    (setq a (car indexlist) indexlist (cdr indexlist))
    (write-line (strcat (car a) "\t" (cdr a)) file)
  )

Thank you again for your time Allen (and to Jeff and Tim).

Gary (I found the light switch, now can someone reach it)








Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #47 on: February 11, 2006, 11:09:23 AM »
Oops, I spoke too soon. It's only reading one of the two blocks.

Grrrrrrrrrrr
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make Sheet Index using obectDBX
« Reply #48 on: February 11, 2006, 11:48:17 AM »
Here try this one.


Code removed to update.
« Last Edit: February 12, 2006, 11:07:02 AM by CAB »
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.

Tom

  • Guest
Re: Make Sheet Index using obectDBX
« Reply #49 on: February 11, 2006, 10:08:32 PM »
Quote
Good idea.
The problem with the routine as it was designed is that it pulls blocks from many drawings in the directory.

You could have a select drawing or select directory button
or just filter out drawings that do not contain the required blocks or tags

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make Sheet Index using obectDBX
« Reply #50 on: February 12, 2006, 11:08:25 AM »
Revised code.
List in in drawing order/tab order with headers.

Code removed, revised
« Last Edit: February 12, 2006, 07:15:21 PM by CAB »
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.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #51 on: February 12, 2006, 04:49:06 PM »
Allen

Thanks for the new update. Thanks for your time on this.

I have here the results of yours and Tim's previous routine fixes for my request for finding two attributed blocks within each drawing.

("TAG" "A-01" "SHT_TTL") is the "sheet title-number"
("IRREV" "XX" "X")  is the "revision number-date"

Code: [Select]
;;;from the CRX.lso routine (stripped down version which uses your previous fix)
(defun C:CRX () ;(/ indexlist)
   (defun padout (word len / spaces)
    (repeat (- len (strlen word)) (setq spaces (cons 32 spaces)))
    (strcat word (vl-list->string spaces))
  ) 
  (setq indexlist (getindex '(("IRREV" "XX" "X") ("TAG" "A-01" "SHT_TTL"))))
  (if (member "acetutil.arx" (arx))(ACET-UI-PROGRESS-DONE)) ;;added progress bar finish
  (foreach itm indexlist
    (princ "\n")
    (princ (strcat
      (padout (cdr (caar itm)) 16) (cdr (cadar itm)) ;this may not be the best way?
      "\t"
      (padout (cdr (caadr itm)) 22) (cdr (cadadr itm))) ;this may not be the best way?
    )
  )
  (princ)
)


This is the result that I am after with princ to the command line (similar to write to file):

11 Feb 2006     1    Title Sheet           A0.00
12 Feb 2006     2    Site Plan             A0.01
12 Feb 2006     3    Project Data          A1.01

The next question I have is how do I keep the routine from erroring out if the second block "revision number-date" is not found? In other words all
of the drawings in the directory will have the "shee ttitle-number" block and some will only have an "revision number-date" block. I f the "revision number-date"
is not found the routine quits.

11 Feb 2006     1    Title Sheet           A0.00
error (if "revision number-date" not found) <-- here I want only the "sheet title-number" found in every drawing

I have included stripped down drawings. In the second drawing, erase the revison attributed block and run the routine.

Gary

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #52 on: February 12, 2006, 05:51:05 PM »
Allen

Sorry, I should have tried this latest version before I posted the last time. Thank you again for your time and effort. I am in your debt.

I tested your laters version. It work perfectly. I had to change it to: (ARCH:CreateIndex '(("IRREV" "XX" "X") ("2436TBA" "A-01" "SHT_TTL")))
I f the revision block is found it reads it, if not found it skips over it. Not explain how you did this...remeber I'm a beginner.

P.S. your previous fix and Tim's fix worked also, only if both blocks are found. Sinc I only use one layout how would you modify this latest version
to get the following format?

11 Feb 2006     1    Title Sheet           A0.00
                            Site Plan               A0.01
12 Feb 2006     3    Project Data          A1.01

The reason I ask is because my next step is to prepare the results for importing into excel.

Code: [Select]
Results from your latest version:

<<<  A0-00.dwg  >>>
---  FullSize  ---
SHT_TTL Cover
A-01 A0.00
---  Model  ---
<<<  A0-01.dwg  >>>
---  FullSize  ---
SHT_TTL Site Plan
A-01 A0.01
---  Model  ---
<<<  A1-01.dwg  >>>
---  FullSize  ---
SHT_TTL Project Data
A-01 A1.01
---  Model  ---
<<<  A1-02.dwg  >>>
---  FullSize  ---
SHT_TTL Fire Proofing Data
A-01 A1.02
---  Model  ---
<<<  A1-03.dwg  >>>
---  FullSize  ---
SHT_TTL Fair Housing Data
A-01 A1.03
---  Model  ---
<<<  A1-04.dwg  >>>
---  FullSize  ---
SHT_TTL ADA Handicap Data
A-01 A1.04
---  Model  ---
<<<  A1-05.dwg  >>>
---  FullSize  ---
SHT_TTL TAS Handicap Data
A-01 A1.05
---  Model  ---
<<<  A2-01a.dwg  >>>
---  FullSize  ---
SHT_TTL Foundation Plan
A-01 A2.01a
---  Model  ---
<<<  A2-01b.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.01b
---  Model  ---
<<<  A2-01c.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.01c
---  Model  ---
<<<  A2-01d.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.01d
---  Model  ---
<<<  A2-01e.dwg  >>>
---  FullSize  ---
SHT_TTL Roof Plan
A-01 A2.01e
---  Model  ---
<<<  A2-02a.dwg  >>>
---  FullSize  ---
SHT_TTL Foundation Plan
A-01 A2.02a
---  Model  ---
<<<  A2-02b.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.02b
---  Model  ---
<<<  A2-02c.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.02c
---  Model  ---
<<<  A2-02d.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.02d
---  Model  ---
<<<  A2-02e.dwg  >>>
---  FullSize  ---
SHT_TTL Roof Plan
A-01 A2.02e
---  Model  ---
<<<  A2-03a.dwg  >>>
---  FullSize  ---
SHT_TTL Foundation Plan
A-01 A2.03a
---  Model  ---
<<<  A2-03b.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.03b
---  Model  ---
<<<  A2-03c.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.03c
---  Model  ---
<<<  A2-03d.dwg  >>>
---  FullSize  ---
SHT_TTL Floor Plan
A-01 A2.03d
---  Model  ---
<<<  A2-03e.dwg  >>>
---  FullSize  ---
SHT_TTL Roof Plan
A-01 A2.03e
---  Model  ---
<<<  A3-00.dwg  >>>
---  FullSize  ---
SHT_TTL Schedules
A-01 A3.00
---  Model  ---
<<<  A3-01.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.01
---  Model  ---
<<<  A3-02a.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.02a
---  Model  ---
<<<  A3-02b.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.02b
---  Model  ---
<<<  A3-02c.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.02c
---  Model  ---
<<<  A3-03a.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.03a
---  Model  ---
<<<  A3-03b.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.03b
---  Model  ---
<<<  A3-03c.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.03c
---  Model  ---
<<<  A3-03d.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.03d
---  Model  ---
<<<  A3-03e.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.03e
---  Model  ---
<<<  A3-04.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.04
---  Model  ---
<<<  A3-05a.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.05a
---  Model  ---
<<<  A3-05b.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.05b
---  Model  ---
<<<  A3-05c.dwg  >>>
---  FullSize  ---
SHT_TTL Unit Plan
A-01 A3.05c
---  Model  ---
<<<  A4-01.dwg  >>>
---  FullSize  ---
SHT_TTL Building Elevations
A-01 A4.01
---  Model  ---
<<<  A4-02.dwg  >>>
---  FullSize  ---
SHT_TTL Building Elevations
A-01 A4.02
---  Model  ---
<<<  A4-03.dwg  >>>
---  FullSize  ---
SHT_TTL Building Elevations
A-01 A4.03
---  Model  ---
<<<  A5-01.dwg  >>>
---  FullSize  ---
SHT_TTL Wall Sections
A-01 A5.01
---  Model  ---
<<<  A5-02.dwg  >>>
---  FullSize  ---
SHT_TTL Wall Sections
A-01 A5.02
---  Model  ---
<<<  A5-03.dwg  >>>
---  FullSize  ---
SHT_TTL Wall Sections
A-01 A5.03
---  Model  ---
<<<  A5-04.dwg  >>>
---  FullSize  ---
SHT_TTL Wall Sections
A-01 A5.04
---  Model  ---
<<<  A5-05.dwg  >>>
---  FullSize  ---
SHT_TTL Wall Sections
A-01 A5.05
---  Model  ---
<<<  A6-01.dwg  >>>
---  FullSize  ---
SHT_TTL Stairs
A-01 A6.01
---  Model  ---
<<<  A6-02.dwg  >>>
---  FullSize  ---
SHT_TTL Stairs
A-01 A6.02
---  Model  ---
<<<  A6-03.dwg  >>>
---  FullSize  ---
SHT_TTL Stairs
A-01 A6.03
---  Model  ---
<<<  A6-04.dwg  >>>
---  FullSize  ---
SHT_TTL Stairs
A-01 A6.04
---  Model  ---
<<<  A7-01.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.01
---  Model  ---
<<<  A7-02.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.02
XX 22 July 2005
X 2
---  Model  ---
<<<  A7-03.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.03
---  Model  ---
<<<  A7-04.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.04
---  Model  ---
<<<  A7-05.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.05
---  Model  ---
<<<  A7-06.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.06
---  Model  ---
<<<  A7-07.dwg  >>>
---  FullSize  ---
SHT_TTL Details
A-01 A7.07
---  Model  ---
<<<  A8-00.dwg  >>>
---  FullSize  ---
SHT_TTL Schedules
A-01 A8.00
---  Model  ---
<<<  A8-01.dwg  >>>
---  FullSize  ---
SHT_TTL Foundation Plan
A-01 A8.01
---  Model  ---
<<<  A8-02.dwg  >>>
---  FullSize  ---
SHT_TTL Leasing Office Plan
A-01 A8.02
---  Model  ---
<<<  A8-03.dwg  >>>
---  FullSize  ---
SHT_TTL Ceiling Plan
A-01 A8.03
---  Model  ---
<<<  A8-04.dwg  >>>
---  FullSize  ---
SHT_TTL Roof Plan
A-01 A8.04
---  Model  ---
<<<  A8-05.dwg  >>>
---  FullSize  ---
SHT_TTL Elevations
A-01 A8.05
---  Model  ---
<<<  A8-06.dwg  >>>
---  FullSize  ---
SHT_TTL Elevations
A-01 A8.06
---  Model  ---
<<<  A8-07.dwg  >>>
---  FullSize  ---
SHT_TTL Elevations
A-01 A8.07
---  Model  ---
<<<  A8-08.dwg  >>>
---  FullSize  ---
SHT_TTL Wall Sections
A-01 A8.08
---  Model  ---
<<<  A9-01.dwg  >>>
---  FullSize  ---
SHT_TTL Mail Kiosk
A-01 A9.01
---  Model  ---
<<<  A9-02.dwg  >>>
---  FullSize  ---
SHT_TTL Garage / Maint. Bldg.
A-01 A9.02
---  Model  ---
<<<  A9-03.dwg  >>>
---  FullSize  ---
SHT_TTL Garage
A-01 A9.03
---  Model  ---
<<<  A9-04.dwg  >>>
---  FullSize  ---
SHT_TTL Garage
A-01 A9.04
---  Model  ---
<<<  A9-05.dwg  >>>
---  FullSize  ---
SHT_TTL Sign and Cabana
A-01 A9.05
---  Model  ---
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make Sheet Index using obectDBX
« Reply #53 on: February 12, 2006, 06:03:43 PM »
Here is a revision:

Look at the new CRX routine.
Note all routines are new.
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.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #54 on: February 12, 2006, 06:21:00 PM »
Allen

You are good, and fast.

In your previous routine:
(foreach dwg indexlist
    (foreach itm dwg
      (if (cdr itm) ;this is to test of non nil?
        (write-line (strcat "" "\t" (cdr itm)) file)
        ;(write-line (strcat (car itm) "\t" (cdr itm)) file) ;if not needed
        ;(write-line (car itm) file) ;if not needed
      )
    )
  )

I like you latest version the best.

And, I see how you did it in the latest version. Sweet. I tried yesterday to figure it out and I was too close to the trees.
I have learned at lot from this exercise. I now have a better handle on lists and I forgot all about assoc. The car's are getting easier.
Saying thanks again seems so lame. You have helped me understand lisp what no book could ever do.

THANKS AGAIN

Gary



Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make Sheet Index using obectDBX
« Reply #55 on: February 12, 2006, 07:16:51 PM »
One more time, found a bug when write to a file.

You're welcome. :-)
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.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #56 on: February 13, 2006, 09:05:34 AM »
Allen

This does not include your latest fix. Where is the bug located (which function)?

Here is my revised routine base upon your latest post and a typical sheet index from the revised routine.
The routine searchs for these two blocks: revision "IRREV" and addedum "IAADD".
It also searchs for the sheet title block either: "TAG" and if not found then "2436TBA".
This works perfectly, an update to your latest post:
(setq blkData '(("IRREV" "XX" "X")("2436TBA" "A-01" "SHT_TTL")("IAADD" "XX" "X")("TAG" "A-01" "SHT_TTL")))

All I need to do now is revise the routine to read the issue date found in the titleblock drawing
"2436TB.dwg", which is xrefed into each sheet file and located in the sheet file directory. Then I can
remove the temporate function: (setq date (ARCH:C_DATE-ISSUE (getvar "tdupdate"))).
Until this search of drawing "2436TB.dwg" is made, I will just have to update the "SheetIndex.txt" file.

Code: [Select]
;;current date function:
(defun ARCH:C_DATE-ISSUE  (j / y d m)
  (setq j (fix j)
        j (- j 1721119.0)
        y (fix (/ (1- (* 4 j)) 146097.0))
        j (- (* j 4.0) 1.0 (* 146097.0 y))
        d (fix (/ j 4.0))
        j (fix (/ (+ (* 4.0 d) 3.0) 1461.0))
        d (- (+ (* 4.0 d) 3.0) (* 1461.0 j))
        d (fix (/ (+ d 4.0) 4.0))
        m (fix (/ (- (* 5.0 d) 3) 153.0))
        d (- (* 5.0 d) 3.0 (* 153.0 m))
        d (fix (/ (+ d 5.0) 5.0))
        y (+ (* 100.0 y) j))
  (if (< m 10.0)
    (setq m (+ m 3))
    (setq m (- m 9)
          y (1+ y)))
  (strcat (if (< D 10)
            "0"
            "")
          (itoa (fix D))
          " "
          (nth (1- (fix m))
               (list "Jan" "Feb" "March" "April" "May" "June" "July" "Aug" "Sept" "Oct" "Nov"
                     "Dec"))
          " "
          (substr (itoa (fix Y)) 1 4)
          ;;3 2)
          ))

Thank you for all of your help. The routine now works as I had hoped. Importing into excel is down the road.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Make Sheet Index using obectDBX
« Reply #57 on: February 13, 2006, 09:29:37 AM »
Revised these routines

getblockatts
ARCH:CreateIndex
C:CRX

Replacing them with mine should not affect what you are doing.
It corrects a bug in the layout name.
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.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #58 on: February 13, 2006, 09:38:03 AM »
Allen

Here is my new TEST updated version. I created a getfolder function from the getindex main function. This routine now does two passes,
one for the titlblock drawing (only one per directory, that is xrefed into each sheet file) to get the issue date. The second pass is the original
search for attributed blocks for sheet name, number etc.....

Still needs some cleanup.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Make Sheet Index using obectDBX
« Reply #59 on: February 13, 2006, 09:44:40 AM »
Allen

oops, here is the file.
Need to simplify the first pass thru the directory, only needs to get one drawing file.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64