See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Calculator that works with mtext

  1. #11
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Calculator that works with mtext

    Quote Originally Posted by Jettero2112
    WOW. Very Cool and Groovy! Thanks! I do have a few observations, though.
    • Won't let me put a space in the suffix or prefix (1 @ xx'-x")
    • Uses decimal units, can this be adjusted to architectural?
    • Only allows you to input the slope factor once. The second time it's run, it skips that question. I have multiple slopes on one drawing. If it would ask you again but give you the option of using the last slope number input.
    • Is there any way to be able to add or subtract a number from the final output before changing the mtext? (want to add or subtract a couple inches from the final number).
    This routine is pretty friggin' cool. Thanks for the help, it's very greatly appreciated!
    Won't let me put a space in the suffix or prefix (1 @ xx'-x")
    CHANGE
    Code:
     (setq mypfix (getstring "nPrefix String"));get a Prefis string put 
       (setq mysFix (getstring "nSuffix String"));Get a suffix string
    TO
    Code:
     
     (setq mypfix (getstring  T "nPrefix String"));get a Prefis string put 
       (setq mysFix (getstring T "nSuffix String"));Get a suffix string
    Uses decimal units, can this be adjusted to architectural?
    CHANGE

    Code:
     
    (setq newText (strcat mypfix  (rtos mydist 2 2)  mysfix));can change mode or precision
    TO
    Code:
      
    (setq newText (strcat mypfix  (rtos mydist 4 2)  mysfix));can change mode or precision
    Is there any way to be able to add or subtract a number from the final output before changing the mtext
    add code after
    Code:
    (setq mydist (* mydist myslope))
    to add number to mydist

  2. #12
    Member Jettero2112's Avatar
    Join Date
    2000-12
    Posts
    24
    Login to Give a bone
    0

    Thumbs up Re: Calculator that works with mtext

    Quote Originally Posted by jwanstaett
    to add number to mydist
    Thanks immensely for the help. Most of it works really well. Still can't get it to ask me for the slope factor each time and it doesn't give me the option to add/subtract a number before posting it to mtext though I might have messed something up there.

    Here is what is currently contained in the file.

    Code:
    ;;;This wonderful program coded by: J Wanstaett
    (DEFUN C:CALMTEXT  (/ myline mymtext mylinedata mydist mytextdata newtext)
      (setq myline nil
     mymtext nil)
      (setq myline (selectObject "LINE" nil))
      (if (= nil myline)
    	(progn	;no Line Selected
    	  (alert "No Line Selected")
    	  )
    	(progn	;a Line was selected
    	  (setq myLineData (entget myline)) ;get the data for the line
    	  (setq myMtext (selectobject "MTEXT" nil))
    	  (if (= nil myMtext)
     (progn	;No Mytext Selected
       (alert "No Mytext Selected")
       )
     (progn	;Mytext was Selected
       (if (= nil myslope);if slope not set get slope
    	 (setq myslope (getreal "nEnter Slope Factor: "))
    	 )
       (setq mydist (distance (cdr (assoc 10 myLineData))
    		  (cdr (assoc 11 myLineData))))
       (setq mydist (* mydist myslope))
     (setq mypfix (getstring  T "nPrefix String"));get a Prefis string put 
       (setq mysFix (getstring T "nSuffix String"));Get a suffix string
    (setq newText (strcat mypfix  (rtos mydist 4 2)  mysfix));can change mode or precision
       (setq myTextdata (entget mymtext))
       (setq mytextdata
       (subst (cons 1 newtext)
       (assoc 1 mytextdata)
       mytextdata))
       (entmod mytextdata)
       )
     )
    	  )
    	)
      )
    ;;Function Selectobject
    ;;ObjectType uper case name of Object to Select
    ;;Exp "LINE" "MTEXT"
    ;;Alertflag not nil to show alerts
    ;;		  nil to show alerts
    ;;retrun the entityname of the selected entity
    ;; or nil if no enity Selected
    (DEFUN SelectObject  (ObjectType AlertFlag / myline myLineData)
      (setq myline nil)
      (setq myline (car (entsel (strcat "nSelect a " ObjectType))))
      (if (= nil myline)
    	(progn	;no Object Selected
    	  (if AlertFlag
     (alert "No Object Select"))
    	  )
    	(progn	;a Object was selected
    	  (setq myLineData (cdr (assoc 0 (entget myline))))
    	 ;get the data for the line
    	  (if (/= myLineData ObjectType)
     (progn	;Object not a line
       (if AlertFlag
    	 (progn
    	   (alert (strcat "You Did Not Select a " ObjectType))
    	   (setq myline nil))
    	 )
       )
     (progn	;Object was type Objectype
      )
     )
    	  )
    	)
      (setq myline myline)
      )
    Again, thank you very much for your help with this, it is truly appreciated.

  3. #13
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Calculator that works with mtext

    if you like to have it ask for slope or set the slope to a new value enter this on the command line before you enter the command


    have it ask for a slope this time
    Code:
     
    (setq myslope nil)
    or set the slope to 6
    Code:
    (seqt myslope 6)

  4. #14
    Member Jettero2112's Avatar
    Join Date
    2000-12
    Posts
    24
    Login to Give a bone
    0

    Talking Re: Calculator that works with mtext

    Quote Originally Posted by jwanstaett
    if you like to have it ask for slope or set the slope to a new value enter this on the command line before you enter the command
    Thanks for the help on this. Everything works wonderfully except for the add/subtract number part. I'm using it right now on a job and it has helped greatly. Thanks again!

  5. #15
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: Calculator that works with mtext

    add the code in red to the progran it ask for a numer to add.
    Code:
     
    (setq mydist (distance (cdr (assoc 10 myLineData))
    		  (cdr (assoc 11 myLineData))))
       (setq mydist (* mydist myslope))
       (setq mydist (+ mydist (getreal "\nEnter Distance to ADD")))
       (setq mypfix (getstring T "\nPrefix String"));get a Prefis string put

  6. #16
    Member Jettero2112's Avatar
    Join Date
    2000-12
    Posts
    24
    Login to Give a bone
    0

    Talking Re: Calculator that works with mtext

    Quote Originally Posted by jwanstaett
    add the code in red to the progran it ask for a numer to add.
    Thank you tremendously for your help! This works friggin' great! Most definitely appreciated!

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 2011-12-14, 11:51 PM
  2. Calculator?
    By david_peterson in forum Revit Structure - General
    Replies: 10
    Last Post: 2009-07-22, 03:11 PM
  3. calculator
    By kornackiph in forum Revit Structure - Wish List
    Replies: 3
    Last Post: 2007-09-17, 11:05 PM
  4. Replies: 3
    Last Post: 2006-10-31, 05:46 PM
  5. MText Calculator, testers required
    By Tommy Kinard in forum VBA/COM Interop
    Replies: 0
    Last Post: 2006-10-09, 06:31 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
  •