Results 1 to 7 of 7

Thread: Programming assistance...

  1. #1
    Member
    Join Date
    2009-06
    Location
    South Brunswick, NJ
    Posts
    6
    Login to Give a bone
    0

    Question Programming assistance...

    I searched the forums and didn't find anything that could help me, so I apologize in advance if this question had been asked before. I am attempting to modify an existing routine I made. I'm stuck on how to code it properly. I am trying to do something along the lines of:

    "Pick start point or enter "O" to select Object: "

    The problem I am having is that the user input is two completely different types. I can't simply use GETSTRING or GETPOINT. Any ideas?

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Programming assistance...

    Use ' getpoint ' along with ' initget '. This will let you do what you want to.

  3. #3
    Member
    Join Date
    2009-06
    Location
    South Brunswick, NJ
    Posts
    6
    Login to Give a bone
    0

    Default Re: Programming assistance...

    That's exactly what I wanted it to do... thx a ton...

    (defun C:Test ()
    (initget 128 "String")
    (setq TEST (getpoint "\nPick start point or <O> for Select Object: "))
    (if (or (= TEST "o")(= TEST "O"))(alert "STRING VALUE")
    (alert "COORDINATE VALUE")
    )
    )

  4. #4
    100 Club
    Join Date
    2008-05
    Posts
    161
    Login to Give a bone
    0

    Default Re: Programming assistance...

    You don't have to use 128 (Bit 7) in your INITGET.

    (initget "Object") would work and would set the value of the symbol to "Object" if the user input either O or Object. This allows you to not use the OR condition in your IF statement.

    I also modified your prompt to look more similar to a standard AutoCAD prompt.

    Code:
    (defun C:TEST ()
      (initget "Object")
      (setq TEST (getpoint "\nPick start point or [Object]: "))
      (if (= TEST "Object")
        (alert "STRING VALUE")
        (alert "COORDINATE VALUE")
      )
    )
    Or if you would prefer that the user not be allowed to enter null input. You can do it like this.

    Code:
    (defun C:TEST ()
      (initget 1 "Object")
      (setq TEST (getpoint "\nPick start point or [Object]: "))
      (if (= TEST "Object")
        (alert "STRING VALUE")
        (alert "COORDINATE VALUE")
      )
    )

  5. #5
    Member
    Join Date
    2009-06
    Location
    South Brunswick, NJ
    Posts
    6
    Login to Give a bone
    0

    Default Re: Programming assistance...

    Even better... thanks to you both!!!

  6. #6
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Programming assistance...

    You're welcome. Glad to see you work it out yourself, and then get just a little help to tweak it to be better.

  7. #7
    Active Member
    Join Date
    2008-08
    Posts
    55
    Login to Give a bone
    0

    Default Re: Programming assistance...

    The way I prefer to handle commands of this nature is to set my first variable to an "implied" selection set (setq ss (ssget "_I"))

    then test the variable to see if it is null, and If it is you would need only ask for the point. If it is not null you know it has an object(s) that are selected at the time your command was run.

    *shrug*

    that's how I like to build that type of command anyway.....

Similar Threads

  1. Roof assistance please
    By cadmaster77 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2010-06-22, 01:30 PM
  2. Pattern Assistance
    By jcoe in forum Revit Architecture - General
    Replies: 2
    Last Post: 2009-12-08, 05:16 PM
  3. remote assistance
    By sfaust in forum Revit Architecture - General
    Replies: 6
    Last Post: 2006-11-30, 08:59 PM
  4. Family Assistance
    By jcoe in forum Revit Architecture - Families
    Replies: 2
    Last Post: 2006-08-22, 08:18 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
  •