Jump to content

Combinevalues.LSP [Add/Divide/Multiply/Subtract object values]


Recommended Posts

Posted (edited)

I have a really old routine that will add & subtract object values, but I was inspired by this thread to write a new one.

 

Allows user to combine [Add, Divide, Multiply, Subtract] values of selected objects. User can also change mode (Add, Divide, Multiply, Subtract) at any time. When finished, user is prompted for placement point of MText with final value.

 

If only Add option used, user has option to average values.

 

Accepted: Attribute, Civil 3D Point, Land Desktop Point, MText, MultiLeader, Text or typed value.

 

Call with CombineValues or AV.

 

Your comments/criticism are greatly appreciated. Enjoy. :)

 

;;; ------------------------------------------------------------------------
;;;    CombineValues.lsp v1.2
;;;
;;;    Copyright© 04.09.10
;;;    Alan J. Thompson (alanjt)
;;;
;;;    Contact: alanjt @ TheSwamp.org, CADTutor.net
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    The following program(s) are provided "as is" and with all faults.
;;;    Alan J. Thompson DOES NOT warrant that the operation of the program(s)
;;;    will be uninterrupted and/or error free.
;;;
;;;    Allows user to combine extracted numerical values of selected Attribute,
;;;    Civil 3D Point, Land Desktop Point, MText, MultiLeader, Text or typed value.
;;;
;;;    Combine options include: Add, Divide, Multiply, Subtract (can be changed at any time).
;;;    If user only adds values, an option to average is available.
;;;    Upon completion, user is prompted to specify placement point MText with final value.
;;;
;;;    Revision History:
;;;
;;;    v1.1 (04.11.10) 1. Updated subroutine: AT:ExtractNumbers
;;;
;;;    v1.2 (04.13.10) 1. Reworked AT:ExtractNumbers subroutine.
;;;            2. Added subroutine AT:ListSelect to select numbers when multiple exist in string.
;;;            3. If multiple numbers exist in string, user is prompted with list box
;;;               to select each desired number. If multiple numbers are selected, they are
;;;               combined and added to display.
;;;            4. Added CV:StripFormat subroutine, as taken from StripMText 5.0b,
;;;               Copyright© Steve Doman and Joe Burke 2010 (with permission), to avoid any
;;;               issues with extracting numbers out text formatting. (Thank you Joe & Steve)
;;;
;;; ------------------------------------------------------------------------

CombineValues-v1.2.gif

CombineValues.LSP

Edited by alanjt
  • Like 2
Posted

hi sir... your lisp is so great and i preciate it... how to download your lisp? tnx

Posted
hi sir... your lisp is so great and i preciate it... how to download your lisp? tnx

Thanks and the file is posted below the GIF.

Posted

shouldn't the sum be equal to 43.55?

and

(AT:ExtractNumbers "..alan..")

Posted
shouldn't the sum be equal to 43.55?

I guess I was thinking about taking the first number, not all. However, since it extracts the numbers into a list, I could easily add an (apply 'f lst) and continue or display a list dialog to select each number. Have to think about that one.

 

shouldn't the sum be equal to 43.55?

and

(AT:ExtractNumbers "..alan..")

Crap, I didn't even think about that one. It even returns 0.0 if fed "..". I may have to rethink Lee's argument about ".3" not being a valid number.

Thanks for looking at it and returning you comments. :)

 

I can't get to it now, but maybe I can work on it some tonight or tomorrow.

Posted

your lisp is great but in my work i need the results rotated at 90 degree and precision like 3.50 if you do so that will be great

Posted
your lisp is great but in my work i need the results rotated at 90 degree and precision like 3.50 if you do so that will be great

Lee already wrote a routine for you that does precisely that.

 

The precision is left up to the user's settings and if you really must have the text rotated 90°, just rotate your UCS before executing the command.

Posted

firest thank's for reply that's right lee wrot routine but your lisp more power because i'm biggner how can i rotate ucs thank's

Posted
firest thank's for reply that's right lee wrot routine but your lisp more power because i'm biggner how can i rotate ucs thank's

Type UCS and pick 2 points at a 90° angle.

 

Command: UCS

Current ucs name:  *WORLD*
Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] 
<World>:
Specify point on X-axis or <Accept>:
Specify point on the XY plane or <Accept>:

Posted

alanje that was cool you are genius what about precision how to make ti like 3.50

Posted

dear sir,

 

very good lisp

thx for sharing

Posted
alanje that was cool you are genius what about precision how to make ti like 3.50

I left the precision up to the user's settings (type Units).

 

dear sir,

 

very good lisp

thx for sharing

 

Thanks and you're welcome. :)

Posted

Major update:

Solved bug in number extraction.

Formatting is no longer an issue.

If object has multiple numbers, user is given option to choose which values to use.

Posted
Major update:

Solved bug in number extraction.

Formatting is no longer an issue.

If object has multiple numbers, user is given option to choose which values to use.

 

Nice idea to use StripFormat - I think I may need to use it in my TextMath routine - I absolutely detest MText formatting codes! :glare:

Posted
Nice idea to use StripFormat - I think I may need to use it in my TextMath routine - I absolutely detest MText formatting codes! :glare:

 

Thanks. :)

As soon as I had solved my number extraction issue, I thought about formatting codes. I decided to ask Joe for permission to use the sub from StripMText. Seemed like the best option; he and Steve have spent a lot of time stripping out formatting codes.

  • 1 month later...
Posted

another thanks to you. i was thinking of making a similar but simple routine like this but i just found this and a very nice one. you're really great.

Posted
another thanks to you. i was thinking of making a similar but simple routine like this but i just found this and a very nice one. you're really great.

You're welcome. Enjoy. :)

  • 5 months later...
Posted

Alanjt, I couldn't find the download link below the gif.

Please check. Thx!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...