Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code
Section - [21] Sample Lisp Programs:

( Part1 - Part2 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Zip codes ]


Top Document: comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code
Previous Document: [20] General helper functions
Next Document: [21.8] How to write XYZ data of selected objects to a file?
See reader questions & answers on this topic! - Help others by sharing your knowledge
[21.1] Globally change texts, polylines, layer utils, datestamp

  For globally changing text attributes use CHTEXT.LSP in your
  sample directory.

  For globally changing polyline attributes, freeze layers by pick
  and other similar tasks search for free lisp tools at any AutoLISP
  site. See "[1]" and some code at "[22]","[23]","[24]"

  For putting a datestamp and others onto your plots automatically
  first check out if your plotter supports HPGL/2. Then use the
  internal HPGL/2 driver and configure the datestamp in HPCONFIG.

  DATESTAMP.LSP: Change the plot header attributes by yourself
  as in [22.2]. A profi plotstamp routine is here:
  http://ourworld.compuserve.com/homepages/tonyt/plotstmp.htm

------------------------------

[21.2] Plot dialog from within Lisp. Using DDE or ActiveX or initdia

  (initdia)(command "_PLOT")

  Calling the PLOT dialogbox from AutoLISP *before R14* was possible
  only under Windows i.e. with LISPPLOT by Mike Dickason. This fed
  the keyboard buffer with keystrokes.
    http://www.cadalog.com/ files/lispd-l/lspplw.zip
  or also: ftp://ftp.mcwi.com/pub/mcwi/lisp/
  Otherwise create a script and call this at the end of your lisp, but
  this will not show up the dialogbox.

  Xiang Zhu: You could have used "DDELISP" under Windows. [shortened]
  ;;; [fixed for all releases]
  (defun DDECMD (str / tmp acadver ddestr)
    (if (not (boundp 'initiate))
      (cond
        ((= 14 (setq acadver (atoi (getvar "ACADVER"))))
         (setq ddestr "AutoCAD.R14.DDE") (arxload "ddelisp"))
        ((= 13 acadver)
         (setq ddestr "autocad.r13.dde") (xload "ddelisp"))
        ((= 12 acadver)
         (setq ddestr "autocad.dde") (xload "ddelisp"))
        (T (princ "DDE not supported")(exit))))
      (if (not (zerop (setq tmp (initiate ddestr "system"))))
        (progn
          (execute tmp (strcat "[" str "]"))
          (terminate tmp)
          str)))
  (ddecmd "_plot ") ; return would be "^13"

  Beware that Acad accepts only DDE commands if the command line is
  active, that means no dialogbox must be open.

  With vlisp/ViLL ActiveX methods can be used to plot, but the
  dialog can not be called:

  ;;; vlisp syntax:
  (setq vlax:ActiveDocument (vla-get-ActiveDocument 
    (vlax-get-Acad-Object)))
  (setq plt (vla-get-plot vlax:ActiveDocument))   ;=> plot object
  (vla-PlotWindow plt pt1 pt2)                    ;WCS pts
  (vla-PlotPreview plt 1)                         ;0; partial, 1: full
  (vla-PlotToDevice plt "Default System Printer") ;if it exists

  With R14 INITDIA was introduced, which can be applied to most but not
  all dialogs:
    (initdia)(command "_PLOT")

  With A2000 use OLE (VLA- methods) instead of DDE. DDE support is 
  discontinued by Microsoft. OLE provides a better object-oriented 
  interface.

------------------------------

[21.3] (entmod) and (entmake) Layers, without (command "_LAYER"...)

  ENTMOD a layer
  I try to change a layer property without calling COMMAND function
  inside a lisp routine.

  Since R13, using the following lisp
    (setq tbl_lst (entget (tblobjname "LAYER" "ANY_LAYER"))
          clr_grp (assoc 62 tbl_lst)
    )
    (entmod (subst (cons 62 (- (cdr clr_grp))) clr_grp tbl_lst))
  you can toggle "ANY_LAYER" On or Off, even it is the current layer.

  But AutoCAD doesn't know a table entry has been changed until you
  click the Layer Control on the toolbar or something similar.
  Besides, you can issue 'DDLMODES to see On/OFf property of
  "ANY_LAYER" changed.
  Doing the same way to freeze a layer, you will still see entities on
  that layer shown on screen, but you can not select them, until you do
  something related to layer settings, and AutoCAD will hide those
  entities.

  ENTMAKE a layer
  You must get your pattern with entget, using the table object name as
  argument. This table object name can be retrieved with the TBLOBJNAME
  function:
  (entget (tblobjname "LAYER" "Any Layer Name")) ; R2000 can have spaces!

  ;;; This routine will create a layer with any name you type:
  (defun C:MLAY ()	; by Reinaldo Togores <rtogores@mundivia.es>
    (setq laynam (getstring "\nLayer name: "))
      (entmake
        (list
          '(0 . "LAYER")
          '(5 . "28")
          '(100 . "AcDbSymbolTableRecord")
          '(100 . "AcDbLayerTableRecord")
          (cons 2 laynam)
          '(70 . 64)
          '(62 . 7)
          '(6 . "CONTINUOUS")
      )))

------------------------------

[21.4] How to select multiple files in Lisp? (as in FILES - Unlock) [new]

  * DOSLIB v4.3 from McNeel contains dos_getfilem,
    http://www.mcneel.com/products.htm#Utilities
  * STDLIB contains std-getfilem
    http://xarch.tu-graz.ac.at/autocad/stdlib/GETFILEM.LSP
  * At http://xarch.tu-graz.ac.at/autocad/progs/MGETFILD.ZIP
    is another lisp helper routine to select multiple files with DCL.
    You will also need VLISP, DOSLIB or the STDLIB to access the
    directory functions. Another lisp version is at
    http://xarch.tu-graz.ac.at/autocad/stdlib/Reini_MFD.LSP

------------------------------

[21.5] Replace multiple blocks

  A search at the lisp archives yielded those hits:
   Cadalyst: http://www.cadonline.com/search.phtml
  => 97code.htm and a question for your username which can be obtained
   free and automatically
  or xarch: http://xarch.tu-graz.ac.at/autocad/code and search for
   "BLOCK;REPLACE"
  => http://xarch.tu-graz.ac.at/autocad/code/cadalyst/94-02/replace.lsp
  also at the Cadalog:
   http://www.cadalog.com/ OpenSource Freeware Keyword: "Block Replace"
  => replace.zip (this one is the best)

------------------------------

[21.6] (vports), VIEWPORT entity, pixel conversion

  VIEWPORT entity:
  The answer to "I can do an (entget) on a VIEWPORT and get its lower
  left (DXF group 10) and upper right (DXF group 11) corner.  But it
  appears that these coordinates are in the paper space system.  What
  I'm interested in finding out is what portion of the "real" drawing
  (the model space drawing) are currently shown in that viewport."
  is at http://xarch.tu-graz.ac.at/autocad/news/vports.lsp

  http://www.ez-sys.net/~coopfra/lisp.htm#view has also some tricks.

  How to change viewports in AutoLISP?
  with (setvar "CVPORT" vport-id)
  see http://xarch.tu-graz.ac.at/autocad/news/change_vports.html

  With the following functions you convert pixel<->drawing units:

  ;;; Conversion pixel to drawing units
  (defun PIX2UNITS (pix)
    (* pix (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE")))))

  ;;; Conversion drawing units to pixel
  (defun UNITS2PIX (units)
    (* units (/ (cadr (getvar "SCREENSIZE"))(getvar "VIEWSIZE"))))

  Note also the "Pixel Off by One" Errors in AutoCAD, written by Vibrant
  http://xarch.tu-graz.ac.at/autocad/news/pixel-off-by-one-error.txt

------------------------------

[21.7] Select all visible objects: zoom coordinates

  Beware that with (ssget) you will only get visible objects, because
  all interface functions (entsel,ssget,osnap) work with pixel, only
  (ssget "X") will select not visible objects.

  ;;; returns a list of the actual viewport corners in WCS
  (defun ZOOMPTS ( / ctr h screen ratio size size_2)
    (setq ctr (xy-of (getvar "VIEWCTR")) ;3D -> 2D
          h   (getvar "VIEWSIZE")        ;real
          screen (getvar "SCREENSIZE")   ;2D: Pixel x,y
          ratio (/ (float (car screen))  ;aspect ratio
                   (cadr screen))
          size (list (* h ratio) h)      ;screensize in coords
          size_2 (mapcar '/ size '(2.0 2.0)))
      (list (mapcar '- ctr size_2)
            (mapcar '+ ctr size_2)))
  (defun XY-OF (pt) (list (car pt)(cadr pt)))   ;assure 2D coords

  Note: The points returned are in WCS but this is ok, because the
    "CP" "WP" and "P" options of ssget expect WCS points.
    "W" and "C" require UCS points - why the difference I don't know.

  ;;; one way to define this function
  (defun SSALL-VISIBLE (/ l)
    (ssget "C" (car (setq l (maptrans0-1 (zoompts)))) (cadr l)))
  ;;; or another
  (defun SSALL-VISIBLE-1 ()      ;combine "C" and (p1 p2) to one list
    (apply 'ssget (append '("C") (maptrans0-1 (zoompts)))))

  ;;; map some pts from WCS to UCS, easier with just one argument
  (defun MAPTRANS0-1 (pts) (mapcar '(lambda (pt)(trans pt 0 1)) pts))

User Contributions:

1
Mar 17, 2023 @ 5:17 pm
Regardless if you believe in God or not, read this message!!!

Throughout time, we can see how we have been carefully conditioned to come to this point where we are on the verge of a cashless society. Did you know that the Bible foretold of this event almost 2,000 years ago?

In the book of Revelation 13:16-18, we read,

"He (the false prophet who deceives many by his miracles--Revelation 19:20) causes all, both small and great, rich and poor, free and slave, to receive a mark on their right hand or on their foreheads, and that no one may buy or sell except one who has the mark or the name of the beast, or the number of his name.

Here is wisdom. Let him who has understanding calculate the number of the beast, for it is the number of a man: His number is 666."

Referring to the last generation, this could only be speaking of a cashless society. Why so? Revelation 13:17 states that we cannot buy or sell unless we receive the mark of the beast. If physical money was still in use, we could buy or sell with one another without receiving the mark. This would contradict scripture that states we need the mark to buy or sell!

These verses could not be referring to something purely spiritual as scripture references two physical locations (our right hand or forehead) stating the mark will be on one "OR" the other. If this mark was purely spiritual, it would indicate both places, or one--not one OR the other!

This is where it comes together. It is amazing how accurate the Bible is concerning the implantable RFID microchip. Here is information from a man named Carl Sanders who worked with a team of engineers to help develop this RFID chip:

"Carl Sanders sat in seventeen New World Order meetings with heads-of-state officials such as Henry Kissinger and Bob Gates of the C.I.A. to discuss plans on how to bring about this one-world system. The government commissioned Carl Sanders to design a microchip for identifying and controlling the peoples of the world—a microchip that could be inserted under the skin with a hypodermic needle (a quick, convenient method that would be gradually accepted by society).

Carl Sanders, with a team of engineers behind him, with U.S. grant monies supplied by tax dollars, took on this project and designed a microchip that is powered by a lithium battery, rechargeable through the temperature changes in our skin. Without the knowledge of the Bible (Brother Sanders was not a Christian at the time), these engineers spent one-and-a-half-million dollars doing research on the best and most convenient place to have the microchip inserted.

Guess what? These researchers found that the forehead and the back of the hand (the two places the Bible says the mark will go) are not just the most convenient places, but are also the only viable places for rapid, consistent temperature changes in the skin to recharge the lithium battery. The microchip is approximately seven millimeters in length, .75 millimeters in diameter, about the size of a grain of rice. It is capable of storing pages upon pages of information about you. All your general history, work history, criminal record, health history, and financial data can be stored on this chip.

Brother Sanders believes that this microchip, which he regretfully helped design, is the “mark” spoken about in Revelation 13:16–18. The original Greek word for “mark” is “charagma,” which means a “scratch or etching.” It is also interesting to note that the number 666 is actually a word in the original Greek. The word is “chi xi stigma,” with the last part, “stigma,” also meaning “to stick or prick.” Carl believes this is referring to a hypodermic needle when they poke into the skin to inject the microchip."

Mr. Sanders asked a doctor what would happen if the lithium contained within the RFID microchip leaked into the body. The doctor replied by saying a terrible sore would appea (...)

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code
Previous Document: [20] General helper functions
Next Document: [21.8] How to write XYZ data of selected objects to a file?

Part1 - Part2 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
rurban@xarch.tu-graz.ac.at (Reini Urban)





Last Update March 27 2014 @ 02:11 PM