Results 1 to 2 of 2

Thread: Conditional Lisp call to insert data based on user input

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2010-08
    Posts
    1
    Login to Give a bone
    0

    Default Conditional Lisp call to insert data based on user input

    Since I am a newbie to the LISP world I am trying to create this lisp that works great for one condition without the conditional callout, but when I do add conditions it does not do what it is supposed to do (attaching a drawing to the current drawing using the mapping tools.
    So the code is this :

    Code:
    ;***
    ;***Insert Data
    ;***
    
    (defun c:esd_gcid ( / GRDREF MAPPATH)
      (setvar "cmdecho" 1)
      (setvar "filedia" 0)
      (setvar "cmddia" 0)
      (command "layer" "M" "G-NPLT" "")
      (command "rectang" PAUSE PAUSE)
      (princ "\nCAD data...")
      (setq GRDREF (getstring "Enter CAD Data Name: "))
      (cond
    	( (= GRDDEF "TCAD") (setq MAPPATH (strcat "M:\\GIS-CAD\\Cadastre\\TCAD\\DWG\\" GRDREF)))
    	( (= GRDDEF "TCAD-TEXT") (setq MAPPATH (strcat "M:\\GIS-CAD\\Cadastre\\TCAD\\DWG\\" GRDREF)))
    	)
      (command "adedrawings" "AT" MAPPATH "X")
      (command "adequery" "C" "D" "L" "L" "P" "C" PAUSE "X" "E" "D")
      (command "adedrawings" "DE" "*" "X")
      (setvar "cmddia" 1)
      (setvar "filedia" 1)
      (princ)
    )
    
    The original script with only one condition works fine as 
    
    (defun c:esd_gcid ( / GRDREF MAPPATH)
      (setvar "cmdecho" 1)
      (setvar "filedia" 0)
      (setvar "cmddia" 0)
      (command "layer" "M" "G-NPLT" "")
      (command "rectang" PAUSE PAUSE)
      (princ "\nCAD data...")
      (setq GRDREF (getstring "Enter CAD Data Name: "))
      (setq MAPPATH (strcat "M:\\GIS-CAD\\Cadastre\\TCAD\\DWG\\" GRDREF))	
      (command "adedrawings" "AT" MAPPATH "X")
      (command "adequery" "C" "D" "L" "L" "P" "C" PAUSE "X" "E" "D")
      (command "adedrawings" "DE" "*" "X")
      (setvar "cmddia" 1)
      (setvar "filedia" 1)
      (princ)
    )
    So what am I missing under the conditions?
    Last edited by Opie; 2015-03-17 at 06:08 PM. Reason: [code] tags added

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Conditional Lisp call to insert data based on user input

    Start by replacing
    Code:
      (setq GRDREF (getstring "Enter CAD Data Name: "))
    with
    Code:
      (initget "TCAD TCAD-TEXT")
      (setq GRDREF (getkword " [TCAD/TCAD-TEXT]: "))
    also why do both conditions set MAPPATH to the same value?

Similar Threads

  1. Replies: 2
    Last Post: 2015-07-27, 05:10 AM
  2. Insert specific block based on user criteria
    By jimlapier in forum AutoLISP
    Replies: 1
    Last Post: 2012-02-21, 07:41 PM
  3. parameter conditional statement along w/ user input
    By Ning Zhou in forum Revit Architecture - Families
    Replies: 5
    Last Post: 2009-10-07, 05:27 PM
  4. Find/Replace Attributes based on user input
    By eric.hawkins in forum AutoLISP
    Replies: 7
    Last Post: 2009-01-05, 07:52 AM
  5. Insert Block, allow user to enter data, then have the data placed in a Table
    By thomas.stright in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2006-08-11, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •