Results 1 to 4 of 4

Thread: Trying to us numerical value of 1.5

  1. #1
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    383
    Login to Give a bone
    0

    Default Trying to us numerical value of 1.5

    I am trying to use 1.5 and 1.25 for nipple sizes but it will not accept decimals
    can anyone help me with this problem?
    Code:
    (defun C:nipple	(/ intDiameter)
      (command "insert")
      (setq intDiameter (getint "\nEnter Nipple Diameter: "))
      (command (strcat "Nipple_" (itoa intDiameter)) pause "1" "1")
      (while (= (getvar "cmdactive") 0))
      (command "regen")
      (princ)
    )
    Thanks everyone

    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Mike.Perry; 2006-05-09 at 08:34 PM. Reason: [CODE] tags added.

  2. #2
    100 Club CADmium's Avatar
    Join Date
    2004-08
    Location
    Eberswalde, Germany, Europe
    Posts
    128
    Login to Give a bone
    0

    Default Re: Trying to us numerical value of 1.5

    for accept decimals use getreal and to convert the real into a string use rtos

  3. #3
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    383
    Login to Give a bone
    0

    Default Re: Trying to us numerical value of 1.5

    What do I use instead of "intdiameter"
    The following does not work
    Code:
    (defun C:flange	(/ intdiameter)
      (command "insert")
      (setq intdiameter (getreal "\nEnter Flange Diameter: "))
      (command (strcat "flange_" (rtos intdiameter)) pause "1" "1")
      (while (= (getvar "cmdactive") 0))
      (command "regen")
      (princ)
    )
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Mike.Perry; 2006-05-09 at 08:35 PM. Reason: [CODE] tags added.

  4. #4
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Trying to us numerical value of 1.5

    Hi Andre,
    Try:
    Code:
    (defun C:flange (/ intdiameter)
    (setq intdiameter (getreal "\nEnter Flange Diameter: "))
    (command "-insert" (strcat "flange_" (rtos intdiameter 2 2)) pause "1" "1")  
    (princ)
    )
    The (rtos intdiameter 2 2) tells it to return in decimal format and 2 decimal places,
    which should match your block name - be careful here - block names should be flange_1.25 and flange_1.50

    There is some other error checking needed, like verifying that the block exists (look at tblsearch in the help file) etc. Post back if you need help.
    Tim Creary
    S&D
    DILLIGAF

Similar Threads

  1. numerical data out of range
    By MikeJarosz in forum Revit Architecture - General
    Replies: 3
    Last Post: 2010-11-08, 07:18 PM
  2. numerical family
    By clog boy in forum Revit Architecture - Families
    Replies: 14
    Last Post: 2009-05-29, 12:33 PM
  3. 'Up' key to retrieve previous numerical values
    By Neda Anser in forum AutoCAD General
    Replies: 3
    Last Post: 2006-10-26, 04:34 PM
  4. Numerical organization
    By Bill.Jensen in forum Project Navigator
    Replies: 0
    Last Post: 2006-06-14, 10:43 PM
  5. Formulas with Numerical Instance Parameter Values
    By Chad Smith in forum Revit Architecture - Tips & Tricks
    Replies: 4
    Last Post: 2004-02-12, 03:46 AM

Posting Permissions

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