Jump to content

Recommended Posts

Posted

i have a LISP for a tadpole

 

but it dont work i get

Command: tadpole
Pick Bottom of Slope :
Pick Top of Slope : INSERT Enter block name or [?]: Z:/CAD GLOBAL CONFIG/GLOBAL 
STANDARD SYMBOLS/GENERAL/GLOBAL TADPOLE
"GLOBAL TADPOLE.dwg": Can't find file in search path:
 Z:\E Network\003 Incident Management\12 Contingency Planning\Mat Troke\ONDR 
To Area 7\N8\RAC\ (current directory)
 C:\Documents and Settings\adam.smith\application data\autodesk\autocad 
2010\r18.0\enu\support\
 C:\program files\autocad 2010\support\
 C:\program files\autocad 2010\fonts\
 C:\program files\autocad 2010\help\
 C:\program files\autocad 2010\express\
 C:\program files\autocad 2010\support\color\
 C:\Program Files\AutoCAD 2010\drv\
 C:\Program Files\AutoCAD 2010\
*Invalid*
; error: Function cancelled

 

the lisp file is

;;; inserts a scaled Global tadpole symbol and rotates to suit
(DEFUN C:TADPOLE ()
  (SETQ PT1 (GETPOINT "\nPick Bottom of Slope : "))
  (TERPRI)
  (SETQ PT2 (GETPOINT PT1 "Pick Top of Slope : "))
  (SETQ TSZ (DISTANCE PT1 PT2))
  (SETQ ANG (+ (ANGLE PT1 PT2) (/ PI 2)))
  (SETQ ANG (* ANG (/ 180 PI)))
  (COMMAND "INSERT" "Z:/CAD GLOBAL CONFIG/GLOBAL STANDARD SYMBOLS/GENERAL/GLOBAL TADPOLE" PT1 TSZ "" ANG)
  (TERPRI)
(princ)
(PRINC "\nTadpole Inserted")
(princ)
)

 

any ideas??

Posted

I haven't tested this what if you try one of the highlighted changes (below)? First just try the dash then try changing the slashes.

(COMMAND "[b][color=Red]-[/color][/b]INSERT" "Z:[color=Red]\[/color]CAD GLOBAL CONFIG[color=Red]\[/color]GLOBAL STANDARD SYMBOLS[color=Red]\[/color]GENERAL[color=Red]\[/color]GLOBAL TADPOLE" PT1 TSZ "" ANG)

Note: the dash supresses the insert dialog box.

Posted

o god im going totaly stupid forget this i have got this lisp from another company so the fil path is the problem so clear once you look at it :oops:

 

thanks anyway Steve

Posted

I would approach it like this:

 

(defun c:TadPole (/ InsertBlock p1 p2)
 (vl-load-com)

 (defun InsertBlock (blk pt scl ang)
   (setq *doc (cond (*doc) ((vla-get-ActiveDocument
                              (vlax-get-acad-object)))))
   
   (cond (  (not (or (and (eq "" (vl-filename-extension blk))
                          (tblsearch "BLOCK" blk)
                          (setq blk
                            (findfile
                              (strcat (if (eq "" (vl-filename-extension blk))
                                        ".dwg" "")))))
                     (setq blk (findfile blk)))))

         (  (vla-InsertBlock
              (if (zerop (vla-get-ActiveSpace *doc))
                (vla-get-PaperSpace *doc)
                (vla-get-ModelSpace *doc))
              (vlax-3D-point pt) blk scl scl scl ang))))

 (if (and (setq p1 (getpoint "\nPick Bottom of Slope: "))
          (setq p2 (getpoint "\nPick Top of Slope: " p1)))
   
   (InsertBlock "C:\\Users\\myBlock.dwg" p1
     (distance p1 p2) (+ (angle p1 p2) (/ pi 2.))))

 (princ))
     
   
               

          

 

Change the path as necessary.

 

If using a full filepath for the block, use double backslashes. Else the path can be "block.dwg" or just "block".

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...