Jump to content

adding the rotate function to this routine.


Recommended Posts

Posted

Happy New Year to all,

 

I am wondering if anyone can help with adding the command to rotate in this lisp routine.

 

Here is the routine;

 

(defun c:1 (/ *error* oldLayer layerName pt)

 

;; Error handler

(defun *error* nil

(if oldLayer

(setvar 'clayer oldLayer)))

 

;; Main code

(setq oldLayer (getvar 'clayer))

(if (not (tblsearch "layer" (setq layerName "generalplumbingstack")))

(command "._-layer" "_new" layerName ""))

(setvar 'clayer layerName)

(prompt "\n >> Specify Insertion Points: ")

(while (/= nil (setq pt (getpoint)))

(command "._-insert" "plumbingstack1-30" pt pause "" 0))

(setvar 'clayer oldLayer)

(princ))

 

Thanks for any and all help.

Posted

Just add another pause for rotation angle.

 

(command "._-insert" "plumbingstack1-30" pt pause pause))

Posted (edited)

BTW, If you don't mind please edit your post and place the code between code brackets.

See here: http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines

 

Also there are other issues with the way your code is written. I suggest you give your code another check over.

 

 

This is what it should look like when you add code brackets.

(defun c:1 (/ *error* oldLayer layerName pt)

;; Error handler
(defun *error* nil
(if oldLayer
(setvar 'clayer oldLayer)))

;; Main code
(setq oldLayer (getvar 'clayer))
(if (not (tblsearch "layer" (setq layerName "generalplumbingstack")))
(command "._-layer" "_new" layerName ""))
(setvar 'clayer layerName)
(prompt "\n >> Specify Insertion Points: ")
(while (/= nil (setq pt (getpoint)))
(command "._-insert" "plumbingstack1-30" pt pause "" 0))
(setvar 'clayer oldLayer)
(princ))

 

 

Hint: Your error handler needs some work.

Edited by The Buzzard
Posted

I assembled this for you to try. Adjust it as you see fit.

 

(defun c:1 (/ *error* bs layerName pt ra SUS SUS_LST TERR)
 (setq SUS_LST (list "clayer")
       SUS     (mapcar 'getvar SUS_LST)
       TERR *error*
      *error* ETRAP)
 (MAIN)
 (princ))
(princ "1.lsp loaded...")
(princ "\nType 1 to start program.")
;
; Main code
;
(defun MAIN ()
 (setq layername "generalplumbingstack")
 (if (not (tblsearch "layer" layername))
   (command "._-layer" "_m" layerName ""))
 (if (/= (setq pt (getpoint "\nInsertion pt: ")) nil)
   (progn
     (setq bs (getint "\nBlock scale: "))
     (setq ra (getint "\nRotation angle: "))
     (command "._-insert" "plumbingstack1-30" pt bs bs ra)
   )
 )
 (RUS)
 (princ))
(princ)
;
; Restore User Settings
;
(defun RUS ()
 (setq *error* TERR)
 (if SUS (mapcar 'setvar SUS_LST SUS))
 (princ "\n1.lsp has completed and will now restore your settings and exit.")
 (princ))
(princ)
;
; Error Trap
;
(defun ETRAP (EMSG)
 (command nil nil nil)
 (if (not (member EMSG '("console break" "Function cancelled")))
   (princ (strcat "\nError:" EMSG)))
 (if SUS (mapcar 'setvar SUS_LST SUS))
 (princ
   (strcat "\n1.lsp has encountered a user error!"
           "\nProgram will now restore your settings and exit."))
 (setq *error* TERR)
 (terpri)
 (princ))
(princ)

 

 

I would like to point out that it would be better to use an entmake solution over the command call

Posted

Thanks alot for the help! I will try this new routine as well.

 

Another quick question that I have would be creating a block that with text that is editable. Is this possible and if so how would I create it?

 

Thanks again!

Posted

No problem, But I just made a few small fixes to mine on my last post. Try that one.

 

On your question, Do you mean attributes?

 

 

 

 

Attached is a sample code with a dialog that stores the block definition with attributes in the code . It uses entmake with dxf data.

 

Not sure if this is the route you want to take, But I thought I would put it out there.

Make sure both files are in the ACAD search support path.

BLKLIB.zip

Posted

To give you an idea on how to make the block definition, I would take the block in it exploded state and get the dxf data for each item in the block.

 

 

Below is the definitions for the three blocks in the program. They share however a common attribute. If your attribute are going to have different tags then the code could be written a bit differently. The attcahed PDXF.lsp below is used to get the dxf data from each entity. In the AutoCAD Developer Help Section there is a section on DXF data and the type of data required for each type of entity.

The PDXF.lsp will show the data and you would copy this to be used for your block defintion. I would suggest you pull up other threads on the subject and there are many here. David Bethel is the King of DXF in my opinion. Lee Mac also has many great thread on this as well.

 

To make this easier on both of us, Please try to review the code as best you can then get back to this thread with your questions. I will answer as best I can. There is alot of information to cover.

 

 

(defun BLKLIB_BD ()
 (entmake
   (list
     (cons 0   "block")
     (cons 2    SYM)
     (cons 10  (list 0.0 0.0 0.0))
     (cons 70   2)))
 (cond
   ((= SYM "TRI")
    (entmake
      (list 
        (cons 0   "LWPOLYLINE")
        (cons 100 "AcDbEntity")
        (cons 8   "0")
        (cons 100 "AcDbPolyline")
        (cons 90   3)
        (cons 70   1)
        (cons 43   0.0)
        (cons 10  (list -0.00016575 0.288101))
        (cons 10  (list -0.249503 -0.143763))
        (cons 10  (list 0.249171 -0.143763)))))
   ((= SYM "SQR")
    (entmake 
      (list
        (cons 0   "LWPOLYLINE")
        (cons 100 "AcDbEntity")
        (cons 8   "0")
        (cons 100 "AcDbPolyline")
        (cons 90   4)
        (cons 70   1)
        (cons 43   0.0)
        (cons 10  (list -0.288267 0.287769))
        (cons 10  (list -0.287604 -0.288432))
        (cons 10  (list  0.288598 -0.287769))
        (cons 10  (list  0.287935 0.288432)))))
   ((= SYM "CIR")
    (entmake
      (list
        (cons 0   "CIRCLE")
        (cons 100 "AcDbEntity")
        (cons 8   "0")
        (cons 100 "AcDbCircle")
        (cons 10  (list  0.00016575 9.53592e-008 0.0))
        (cons 40   0.288101)))))
 (entmake
   (list
     (cons 0   "ATTDEF")
     (cons 100 "AcDbEntity")
     (cons 8    ALAY)
     (cons 100 "AcDbText")
     (cons 10  (list -0.158648 0.404835 0.0))
     (cons 40   0.09375)
     (cons 1    AVAL)
     (cons 7   "Romans")
     (cons 71   0)
     (cons 72   1)
     (cons 11  (list -0.00016575 0.373585 0.0))
     (cons 100 "AcDbAttributeDefinition")
     (cons 3   "Text:")
     (cons 2   "TEXT")
     (cons 70   
     (cons 73   0)
     (cons 74   1)))
 (entmake
   (list
     (cons 0  "endblk")
     (cons 8   "0")))
 (princ))
(princ)

PDXF.LSP

Posted

I will go through and try to get my blocks to work with this and get back to you when I have done a bit of testing.

 

Thanks again for the help.

Posted
I will go through and try to get my blocks to work with this and get back to you when I have done a bit of testing.

 

Thanks again for the help.

 

Ok, But because you may not be familar with entmake, Getting you to understand all this could take some time. If you could provide me with some of the blocks, I could get this started for you. There is also another alternative to put the path of your blocks in the program avoiding the entmake solution alltogether, But that is entirely upto you. Also this can be done with or without a DCL incase you may not be familar with DCL programming as well.

 

Let me know what you want to do.

Posted

I am trying to upload one or two of my symbols but I believe that my office has some sort of firewall that will not allow me to

Posted
I am trying to upload one or two of my symbols but I believe that my office has some sort of firewall that will not allow me to

 

I am only trying to make this as painless as possible for you.

Posted

Using the PDXF.lsp, When I select the Square positiion at coordinates 0,0 and Block Scale at 1 and the block is in an exploded state, The text screen appears with this:

 

(-1 . <Entity name: 7ef70360>)
(0 . "LWPOLYLINE")
(330 . <Entity name: 7ef59cf8>)
(5 . "11C")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbPolyline")
(90 . 4)
(70 . 1)
(43 . 0.0)
(38 . 0.0)
(39 . 0.0)
(10 -0.288267 0.287769)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 -0.287604 -0.288432)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 0.288598 -0.287769)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(10 0.287935 0.288432)
(40 . 0.0)
(41 . 0.0)
(42 . 0.0)
(210 0.0 0.0 1.0)

 

Then I select the DXF data for the Attribute Definition I should have something like this:

 

(-1 . <Entity name: 7ef70368>)
(0 . "ATTDEF")
(330 . <Entity name: 7ef59cf8>)
(5 . "11D")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "SQR TEXT")
(100 . "AcDbText")
(10 -0.158648 0.404835 0.0)
(40 . 0.09375)
(1 . "Square")
(50 . 0.0)
(41 . 1.0)
(51 . 0.0)
(7 . "Romans")
(71 . 0)
(72 . 1)
(11 -0.00016575 0.373585 0.0)
(210 0.0 0.0 1.0)
(100 . "AcDbAttributeDefinition")
(3 . "Text:")
(2 . "TEXT")
(70 . 
(73 . 0)
(74 . 1)

 

 

If you compare this data to the data in the Block Definition in the program you should get an idea how to arrange all this. The meaning of each line can be found as I previously mention in the Developer Help Section under DXF Reference then Entities Section. Each line is explained.

 

Take note also in the program that I do a tablsearch for the block definition, If it does not exist in the drawing the program goes to the Block Definition function.

 

It should start out like this indicating it a block:

 

(defun BLKLIB_BD ()
 (entmake
   (list
     (cons 0   "block")
     (cons 2    SYM)
     (cons 10  (list 0.0 0.0 0.0))
     (cons 70   2)))

 

The entities will follow and the function ends with this:

 

 (entmake
   (list
     (cons 0  "endblk")
     (cons 8   "0")))
 (princ))
(princ)

 

 

Its going to take some time to get use to.

Posted

I am just looking to use my symbols from my library. Would there be a way to sub my directory in some where in order to have that file path used for the routine?

Posted
I am just looking to use my symbols from my library. Would there be a way to sub my directory in some where in order to have that file path used for the routine?

 

I have a simple one somewhere on my computer. I will try to find it. In the mean time maybe someone else may post something real good.

Posted (edited)

I could not find the routine I had mentioned due to it being lost within thousands of other files. So I modified the routine I supplied although I am not sure if I did this correctly. If anyone spots the problem feel free to correct me. I was using findfile if the block definition was not in the drawing, But this will not work unless the symbol directory is in the ACAD Search Support Path. I could swear this was not needed, But now I am uncertain.

 

Anyway the attached program has three external blocks assuming they are in a directory called C:/Symbols. This directory would need to be in the Support path and or can be changed to what you want to name it to. The three blocks are in the program list. You can change these to what you wish as well along with the block scale list which is setup for Imperial units. You may want to change this to metric.

 

I commented the program as much as possible to give you an idea as to whats is going on. I also removed the images incase you decide to use this program with your blocks. To make images for your blocks could be a whole thread by itself, So I did not want to get into it at this point.

 

The program name is BLKLIB2.lsp with BLKLIB2.dcl

Command syntax: BLKLIB2

Place the blocks in a directory called Symbols or choose what you like as long as you edit it in the program.

 

Good Luck and let me know how it goes.

Any problem, I will be happy to answer.

The Buzzard

 

P.S. if someone has something better to offer, Feel free to post it.

 

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

 

I just look findfile up and its restricted to the Support Search Path as shown in the image.

CIRCLE.dwg

TRIANGLE.dwg

SQUARE.dwg

BLKLIB2.dcl

BLKLIB2.lsp

Document1.jpg

Edited by The Buzzard
Additional information added
Posted

Hi Buzzard,

 

I have used the new routine and changed the path for the symbols and made the changes in the program for my symbols names. I am receiving this error message. Error:bad argument type: stringp nil.

 

Any idea's?

Posted
Hi Buzzard,

 

I have used the new routine and changed the path for the symbols and made the changes in the program for my symbols names. I am receiving this error message. Error:bad argument type: stringp nil.

 

Any idea's?

 

 

I am not sure of the changes you made. Can you post the code you changed so can can take a look?

 

Could be several things. Are the blocks you are using have attributes? Did you follow the code from start to finish and check for the nil value?

Posted (edited)

Here are the changes to the routine, note that only the file path and the names of the blocks have been changed. Also sorry about cop paste but for some reason I cant upload to this forum.

 

Thanks

 

;
; BLKLIB2.lsp  Note: This program is only a demo example and has no other purpose.
;                   There are only three blocks in this program for demonstration.
;                   It only shows a method of creating blocks with a built-in block
;                   definition using dxf data and inserting them. No external block
;                   drawings are required.
;                   This program inserts a selected block to a selected scale factor
;                   and places it on its own Object layer with Attribute layer. The
;                   attributes are filled in with no prompting.
;
; Author: Angelo Bozzone
; Original program was SL.lsp created 03|23|06 and modified 05|10|10 to BLKLIB2.lsp
;
; This program requires the following files below to work properly."
; Make sure to have these files together in the same directory."
; Also make sure the the directory is in the AutoCAD Support File Search Path."
;
; BLKLIB2.dcl - AutoCAD Dialog Definition,   Size 1  KB"
; BLKLIB2.lsp - AutoLISP Application Source, Size 14 KB"
; 
; To start this program, At the command prompt type BLKLIB2."
;
; The function directory below list all functions in their assembled order. 
;
;========================================================================================
; No.  | Function Name       | Function Description       
;========================================================================================
; F01  | C:BLKLIB2           | Program Start.
;----------------------------------------------------------------------------------------
; F02  | BLKLIB2_MF          | Main Function.
;----------------------------------------------------------------------------------------
; F03  | BLKLIB2_RTD         | Radians To Degrees.
;----------------------------------------------------------------------------------------
; F04  | BLKLIB2_FS          | Font Style.
;----------------------------------------------------------------------------------------
; F05  | BLKLIB2_CL          | Create Layer.
;----------------------------------------------------------------------------------------
; F06  | BLKLIB2_CPS         | Change Program Settings.
;----------------------------------------------------------------------------------------
; F07  | BLKLIB2_RUS         | Rsstore User Settings.
;----------------------------------------------------------------------------------------
; F08  | BLKLIB2_ET          | Error Trap.
;----------------------------------------------------------------------------------------
;      |                     |
;
;/////////////////////////////////////////////////////////////////////////////////
;
; F01 - Program Start.
;
(defun C:BLKLIB2 (/ ALAY AVAL BNAM BSF BSF_LST CPS DCL_ID DEG INPT IANG OLAY RAD SUS SYM_LST UCLK) ; Declare local variables
 (setq SUS_LST (list "orthomode" "osmode" "cmdecho" "blipmode" "clayer")           ; Save User Settings List
       SUS     (mapcar 'getvar SUS_LST)                                            ; Save User Settings Variable
       TERR *error*                                                                ; Store *error
      *error* BLKLIB2_ET)                                                          ; Goto error trap
 (BLKLIB2_MF)                                                                      ; Goto to Main Function
 (princ))                                                                          ; Exit quietly
(princ "\nBLKLIB2.lsp Loaded, Type BLKLIB2 to start program.")                      ; Print message to command line
;
;//////////////////////////////////////////////////////////////////////
;
; F02 - Main Function.
;
(defun BLKLIB2_MF ()
 (or BLKLIB2:SYM (setq BLKLIB2:SYM "0"))                                           ; Set default Block Name
 (or BLKLIB2:BSF (setq BLKLIB2:BSF "13"))                                          ; Set default Block Scale Factor
 (setq SYM_LST (list "plumbingstack" "gooseneckvent" "squarevent")                                 ; Block Names List
       BSF_LST (list "1/32\" = 1'" "1/16\" = 1'"  "3/32\" = 1'"                    ; Scale Factor List
                     "1/8\" = 1'"  "3/16\" = 1'"  "1/4\" = 1'"
                     "3/8\" = 1'"  "1/2\" = 1'"   "3/4\" = 1'"
                     "1\" = 1'"    "1-1/2\" = 1'" "3\" = 1'"
                     "6\" = 1'"    "1' = 1'"))
 (setq DCL_ID (load_dialog "BLKLIB2.dcl"))                                         ; Load dialog
 (if (not (new_dialog "BLKLIB2" DCL_ID))                                           ; Test for dialog, If not found
   (progn                                                                          ; Then do the following
     (ALERT                                                                        ; Display alert message
       (strcat                                                                     ; Concatenate string
         "\nAttention!"                                                            ; Start message
         "\n"
         "\nThe dialog file BLKLIB2.dcl could not be found."
         "\nBe sure the dialog file BLKLIB2.dcl"
         "\nis in the AutoCAD Support File Search Path."))                         ; End message
     (exit)))                                                                      ; Then exit
 (start_list "SYM")(mapcar 'add_list SYM_LST)(end_list)                            ; Fill the Symbols List
 (start_list "BSF")(mapcar 'add_list BSF_LST)(end_list)                            ; Fill the Block Scale List
 (set_tile "SYM" BLKLIB2:SYM)                                                      ; Set the Block Symbol tile
 (set_tile "BSF" BLKLIB2:BSF)                                                      ; Set the Block Scale tile
 (action_tile "SYM"    "(setq BLKLIB2:SYM $value)")                                ; Get current Block Name value
 (action_tile "BSF"    "(setq BLKLIB2:BSF $value)")                                ; Get current Block Scale value
 (action_tile "cancel" "(done_dialog)(setq UCLK nil)(BLKLIB2_RUS)")                ; Exit program, Set User Click to nil, Restore ;User Settings
 (action_tile "accept" "(done_dialog)(setq UCLK T)")                               ; When OK selected, Set User Click (OK) to true
 (start_dialog)                                                                    ; Start dialog
 (unload_dialog DCL_ID)                                                            ; Unload dialog
 (if UCLK                                                                          ; If OK selected
   (progn                                                                          ; Then do the following
     (cond
       ((= BLKLIB2:SYM "0") (setq BNAM "plumbingstack"))                                ; Set the Block Name
       ((= BLKLIB2:SYM "1") (setq BNAM "gooseneckvent"))
       ((= BLKLIB2:SYM "2") (setq BNAM "squarevent")))
     (cond
       ((= BLKLIB2:BSF "0") (setq BSF 384))                                        ; Set the Block Scale Factor
       ((= BLKLIB2:BSF "1") (setq BSF 192))
       ((= BLKLIB2:BSF "2") (setq BSF 128))
       ((= BLKLIB2:BSF "3") (setq BSF 96))
       ((= BLKLIB2:BSF "4") (setq BSF 64))
       ((= BLKLIB2:BSF "5") (setq BSF 48))
       ((= BLKLIB2:BSF "6") (setq BSF 32))
       ((= BLKLIB2:BSF "7") (setq BSF 24))
       ((= BLKLIB2:BSF "8") (setq BSF 16))
       ((= BLKLIB2:BSF "9") (setq BSF 12))
       ((= BLKLIB2:BSF "10")(setq BSF )
       ((= BLKLIB2:BSF "11")(setq BSF 4))
       ((= BLKLIB2:BSF "12")(setq BSF 2))
       ((= BLKLIB2:BSF "13")(setq BSF 1)))
     (cond
       ((= BNAM "TRIANGLE")(setq ALAY "TRIANGLE TEXT")(setq OLAY BNAM AVAL BNAM)) ; Set the layer attribute layer name, Object layer ;name and Attribute value
       ((= BNAM "SQUARE")  (setq ALAY "SQUARE TEXT")  (setq OLAY BNAM AVAL BNAM))
       ((= BNAM "CIRCLE")  (setq ALAY "CIRCLE TEXT")  (setq OLAY BNAM AVAL BNAM)))
     (BLKLIB2_CPS)                                                                ; Change program settings
     (BLKLIB2_FS "Romans")                                                        ; Set font style to romans Supply One argument
     (BLKLIB2_CL ALAY 2 "Continuous")                                             ; Create attribute layer.  Supply Three arguments
     (BLKLIB2_CL OLAY 1 "Continuous")                                             ; Create object layer.     Supply Three arguments
     (if
       (null
         (tblsearch "block" BNAM)                                                 ; Search drawing for block.
       )
       (findfile (strcat "C:\Documents and Settings\ldibiase\Desktop\Symbol Library" BNAM ".dwg"))                              ; If ;block not found, Find drawing file. 
     )
     (setvar "clayer" OLAY)                                                       ; Set the object layer
     (setvar "osmode" (nth 1 SUS))                                                ; Set object snap to saved user object snap
     (while                                                                       ; Program Loop
       (setq INPT (getpoint "\nSpecify insertion point: "))                       ; Get insertion point
       (if (/= INPT nil)                                                          ; If insertion point nil
         (progn                                                                   ; Then do the following
           (setq IANG (getpoint INPT "\nSpecify orientation angle: ")             ; Set insertion angle
                 INPT (trans INPT 1 0)                                            ; Translate coords
                 IANG (trans IANG 1 0)                                            ; Translate coords
                 RAD  (angle INPT IANG)                                           ; Get the angle in radians between insertion point ;and insertion angle
                 DEG  (BLKLIB2_RTD RAD))                                          ; Convert the radians to degrees
           (command "._-insert" BNAM INPT BSF BSF DEG))))                         ; Insert, Block Name, Insertion Point, Block Scale ;Factor, Block Scale Factor, and Angle in degrees
     (BLKLIB2_MF)))                                                               ; If insertion point nill return to the dialog
 (princ))                                                                         ; Exit quietly
(princ)
;
;//////////////////////////////////////////////////////////////////////
;
; F03 - Radians to Degrees.
;
(defun BLKLIB2_RTD (RAD)(* 180.0 (/ RAD pi)))                                      ; Convert radians to degrees
;
;//////////////////////////////////////////////////////////////////////
;
; F04 - Font Style.
;
(defun BLKLIB2_FS (FSTY / TWF TOA PFN BFN)       ;Declare arguments and local variables
 (setq TWF 1.0 TOA 0.0 PFN "Romans.shx" BFN "") ;Set the font style parameters
 (if (null (tblsearch "style" FSTY))            ;Search drawing for font style
   (entmake                                     ;Entity make
     (list                                      ;List
       (cons 0   "STYLE")                       ;Entity Type
       (cons 100 "AcDbSymbolTableRecord")       ;Subclass marker
       (cons 100 "AcDbTextStyleTableRecord")    ;Subclass marker
       (cons 2    FSTY)                         ;Font Style Name
       (cons 70   0)                            ;Flag value
       (cons 40   0)                            ;Fixed text height, 0 if not fixed
       (cons 41   TWF)                          ;Text width factor
       (cons 50   TOA)                          ;Text obliquing angle
       (cons 3    PFN)                          ;Primary font file name
       (cons 4    BFN))))                       ;Big font file name
 (princ))                                       ;Exit quietly
(princ)
;
;//////////////////////////////////////////////////////////////////////
;
; F05 - Create Layer.
;
(defun BLKLIB2_CL (LNAM LCLR LTYP)               ;Declare arguments and local variables
 (if (null (tblsearch "layer" LNAM))            ;Search drawing for layer name
   (entmake                                     ;Entity make
     (list                                      ;List
       (cons   0 "LAYER")                       ;Entiy type
       (cons 100 "AcDbSymbolTableRecord")       ;Subclass marker
       (cons 100 "AcDbLayerTableRecord")        ;Subclass marker
       (cons   2  LNAM)                         ;Layer name
       (cons  70  0)                            ;Flag value
       (cons  62  LCLR)                         ;Layer color
       (cons   6  LTYP)                         ;Layer linetype
       (cons 290  1))))                         ;Plotting flag
 (princ))                                       ;Exit quietly
(princ)
;
;//////////////////////////////////////////////////////////////////////
;
; F06 - Change Program Settings.
;
(defun BLKLIB2_CPS ()
 (setq CPS (list 1 0 0 0))
 (mapcar (function setvar)(list "orthomode" "osmode" "cmdecho" "blipmode") CPS)
 (princ))
(princ)
;
;//////////////////////////////////////////////////////////////////////
;
; F07 - Restore User Settings.
;
(defun BLKLIB2_RUS ()
 (setq *error* TERR)
 (if SUS (mapcar 'setvar SUS_LST SUS))
 (princ "\nBLKLIB2.lsp has completed and will now restore your settings and exit.")
 (princ))
(princ)
;
;//////////////////////////////////////////////////////////////////////
;
; F08 - Error Trap.
;
(defun BLKLIB2_ET (ERRORMSG)
 (command nil nil nil)
 (if (not (member ERRORMSG '("console break" "Function cancelled")))
   (princ (strcat "\nError:" ERRORMSG)))
 (if SUS (mapcar 'setvar SUS_LST SUS))
 (princ
   (strcat "\nBLKLIB2.lsp has encountered a user error!"
           "\nProgram will now restore your settings and exit."))
 (terpri)
 (setq *error* TERR)
 (princ))
(princ)
;
;//////////////////////////////////////////////////////////////////////

Edited by CADTutor
CODE tags added
Posted

You did not edit this conditional for one thing.

What are the layer names?

What is the object layer name?

Are there attributes?

Are the attributes on a different layer?

     (cond
       ((= BNAM "TRIANGLE")(setq ALAY "TRIANGLE TEXT")(setq OLAY BNAM AVAL BNAM)) 
       ((= BNAM "SQUARE")  (setq ALAY "SQUARE TEXT")  (setq OLAY BNAM AVAL BNAM))
       ((= BNAM "CIRCLE")  (setq ALAY "CIRCLE TEXT")  (setq OLAY BNAM AVAL BNAM)))

 

 

 

The slashes are not correct.

(findfile (strcat "C:\Documents and Settings\ldibiase\Desktop\Symbol Library" BNAM ".dwg")) 

 

 

 

You can do it one of two ways like this.

(findfile (strcat "C:\\Documents and Settings\\ldibiase\\Desktop\\Symbol Library" BNAM ".dwg"))
(findfile (strcat "C:/Documents and Settings/ldibiase/Desktop/Symbol Library" BNAM ".dwg"))

  • 1 month later...
Posted

Hi there,

 

Sorry that I have not been around for a long while. I lost a family member and I have been trying to get everything in order. If you are still out there i would like to continue with trying to make this work for me again.

 

I will wait to see if you are still around to help and I will get back to you with further info.

 

Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...