See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Set X until next setting of X

  1. #1
    I could stop if I wanted to
    Join Date
    2009-10
    Posts
    262
    Login to Give a bone
    0

    Default Set X until next setting of X

    Code:
    (Setq X (getstring "\nEnter X Value: "))
    The Value entered changes X...

    How can I change the value of X to 1 within the lisp without requiring a string input such as (Setq X (1)), until the code runs across x again?

    Having it change for every occurrence of Set X

    So If I had...
    Code:
    (Setq X (1))
    X would equal 1 until it gets to this part of the code
    Code:
    (Setq X (2))
    X would equal 2 until it gets to this part of the code
    Code:
    (Setq X (3))
    X would equal 3 until it gets to this part of the code
    Code:
    (Setq X (4))
    Last edited by BlackBox; 2015-05-20 at 11:22 PM. Reason: Please use [CODE] Tags

  2. #2
    I could stop if I wanted to
    Join Date
    2009-10
    Posts
    262
    Login to Give a bone
    0

    Default Re: Set X until next setting of X

    Nvm I realized it took a simple (set x 1)

  3. #3
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    1

    Default Re: Set X until next setting of X

    I think you may be a little confused so I will try to elaborate on Set and Setq.
    Code:
    (setq X (getstring "\nEnter String: "))
    
    (set (quote X) (getstring "\nEnter String: "))
    Are fundamentally equal.

    You setting the symbol X to be a value.

    setq and set are different functions

    In your code above you have

    Code:
     (setq X (1))
    Should be

    Code:
    (setq X "1")
    Since in you example you set X to a string.

    If you want it to be a number

    Code:
    (setq X (getdist "\nEnter Number: "))
    or

    Code:
    (setq X (getreal "\nEnter Number: "))
    for whole numbers

    Code:
    (setq X (getint "\nEnter Integer: "))
    for Integers

    If I were you I would use setq and not use set.
    AutomateCAD

Similar Threads

  1. Setting Up ASD
    By kathy71046 in forum AutoCAD Structural Detailing
    Replies: 6
    Last Post: 2010-03-25, 09:27 AM
  2. Setting 'z' value
    By J17 in forum CAD Management - General
    Replies: 2
    Last Post: 2009-09-15, 01:27 PM
  3. Setting Up Help
    By lonewolfjustin in forum Revit MEP - General
    Replies: 13
    Last Post: 2008-10-21, 12:24 PM
  4. ?? setting up 09
    By robert.1.hall72202 in forum AutoCAD General
    Replies: 6
    Last Post: 2008-09-12, 06:05 PM
  5. Save reminder - system setting or project setting?
    By patricks in forum Revit Architecture - General
    Replies: 4
    Last Post: 2005-07-08, 01:47 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
  •