Author Topic: How to statistics the total number of parts?  (Read 19330 times)

0 Members and 1 Guest are viewing this topic.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to statistics the total number of parts?
« Reply #30 on: November 22, 2011, 09:19:19 AM »
ElpanovEvgeniy,

What are the chances that you'd be willing to put that together in a single PDF, available for download?

in Russian - no problems with quality translation I can not ...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to statistics the total number of parts?
« Reply #31 on: November 22, 2011, 09:24:04 AM »
Do you want to translate into English?

nivuahc

  • Guest
Re: How to statistics the total number of parts?
« Reply #32 on: November 22, 2011, 09:35:19 AM »
Do you want to translate into English?

I can take a crack at it, as time permits. Unfortunately time is in short supply for me.


GDF

  • Water Moccasin
  • Posts: 2081
Re: How to statistics the total number of parts?
« Reply #33 on: November 22, 2011, 03:12:42 PM »
Thanks Alan.  I didn't have too many nested blocks, so I just created a simple one.

Works great for nested xrefs...sexy.
Thanks Tim for sharing it.
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: How to statistics the total number of parts?
« Reply #34 on: November 23, 2011, 11:01:35 PM »
Do you want to translate into English?

I can take a crack at it, as time permits. Unfortunately time is in short supply for me.

I did a copy & paste to HTML then print to DOC format to get a pretty good document.
Although I lost font colors and some of the code was missing LF CRs but I have edited it into a fairly clean document.
I set all code to red & managed to re-color the first two pages of code but there are some 43 pages so I stopped there.
No more time but I can forward the DOC file if you want to take it to the next level. (with Evgeniy's permission of course)
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.

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: How to statistics the total number of parts?
« Reply #35 on: December 04, 2011, 11:59:02 AM »
Code: [Select]
. . .

;;;writie list data  to the text file
(defun WriteDataFile (file_name data_lst / _tostring file)
  (defun _tostring (x / dimzin)
    (cond
      ((eq 'INT (type x))
       (itoa x)
      )
      ((eq 'REAL (type x))
       (setq dimzin (getvar 'DIMZIN))
       (setvar 'DIMZIN 0)
       (setq x (rtos x 2 8))
       (setvar 'DIMZIN dimzin)
       x
      )
      ((vl-prin1-to-string x))
    ) ;_ 结束cond
  ) ;_ 结束defun

  (if (setq file (open file_name "w"))
    (progn
      (foreach x data_lst (write-line (_tostring x) file))
      (setq file (close file))
      t
    ) ;_ 结束progn
  ) ;_ 结束if
) ;_ 结束defun

. . .

Code: [Select]
(defun NumInc:WriteConfig ( name lst / _tostring file )

    (defun _tostring ( x / dimzin )
        (cond
            (   (eq 'INT (type x))
                (itoa x)
            )
            (   (eq 'REAL (type x))
                (setq dimzin (getvar 'DIMZIN))
                (setvar 'DIMZIN 0)
                (setq x (rtos x 2 8))
                (setvar 'DIMZIN dimzin)
                x
            )
            (   (vl-prin1-to-string x)   )
        )
    )
   
    (if (setq file (open name "w"))
        (progn
            (foreach x lst (write-line (_tostring x) file))
            (setq file (close file))
            t
        )
    )
)

  :-o

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to statistics the total number of parts?
« Reply #36 on: December 04, 2011, 12:20:10 PM »
Why should (setq file (close file))?
Perhaps just enough (close file)...

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: How to statistics the total number of parts?
« Reply #37 on: December 04, 2011, 12:22:10 PM »
Why should (setq file (close file))?
Perhaps just enough (close file)...

Because 'close' always returns nil, so I use it to null the 'file' variable. This way I can check for the 'file' variable in my *error* handler.

xianaihua

  • Guest
Re: How to statistics the total number of parts?
« Reply #38 on: December 04, 2011, 08:15:11 PM »
Hi,lee !
sorry!
Forget your copyright :ugly:
This is a good tool!