rmjcorp Posted September 29, 2011 Share Posted September 29, 2011 (edited) I have been searching and searching with no answer. I would like to be able to use Lee Mac's lsp file "A2F.lsp" but with the output being in SF. the output is coming out in SI and I would like to know how to modify it to come out in a rounded off SF number such as 25sf and not 25.5sf. I have been reading tutorials on how these files are written but it seems I am in over my head. Could someone please assist me? Thanks in advance. Please Note Link of LSP file http://lee-mac.com/lisp/Areas2Field.lsp A2F.lsp Edited September 29, 2011 by rmjcorp To give credit where credit is due Quote Link to comment Share on other sites More sharing options...
MSasu Posted September 29, 2011 Share Posted September 29, 2011 You are looking to round to nearest smaller integer value (round by remove)? I think that you are looking for something like the example below - I have commented the lines to allow you to understand it: (setq AreaSI "3672") ;area in Sqare Inches, string (setq AreaSI (atof AreaSI)) ;convert area to double (setq AreaSF (/ AreaSI 12.0 12.0)) ;transform in Square Feets (setq AreaSF (fix AreaSF)) ;round area to integer (by remove only) (setq AreaSF (rtos AreaSF 2 0)) ;convert area to string Regards, Mircea Quote Link to comment Share on other sites More sharing options...
rmjcorp Posted September 29, 2011 Author Share Posted September 29, 2011 (edited) Thank you for you reply. Could you possibly tell me where to insert it? Edited September 30, 2011 by rmjcorp Quote Link to comment Share on other sites More sharing options...
rmjcorp Posted September 29, 2011 Author Share Posted September 29, 2011 Everywhere I try to place it I get this error "Error: bad argument type: numberp: nil" Quote Link to comment Share on other sites More sharing options...
MSasu Posted September 29, 2011 Share Posted September 29, 2011 Seems that you are using an expression there; sorry I'm not familiar with that so cannot help you. I was thinking that you have the area as a string. Regards, Mircea Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 29, 2011 Share Posted September 29, 2011 I have been searching and searching with no answer. I would like to be able to use Lee Mac's lsp file "A2F.lsp" but with the output being in SF. the output is coming out in SI and I would like to know how to modify it to come out in a rounded off SF number such as 25sf and not 25.5sf. I have been reading tutorials on how these files are written but it seems I am in over my head. Could someone please assist me? Thanks in advance. Hi rmjcorp, Firstly, I would prefer if you provided a link to location of the program or where you found the code, instead of posting the program here; as otherwise I have many different versions of the program strewn over the forum and version control becomes a nightmare. At the top of the code you should find a line specifying the field formatting for the program: (setq format "%lu6%qf1") ;; Field Formatting This follows the same format as displayed on the Field dialog. For example: "%lu6%qf1" = Current Units & Precision "%lu2%pr4" = Decimal Units & 4 d.p. precision Use the Field dialog and command to determine which formatting code you will need to use. Quote Link to comment Share on other sites More sharing options...
rmjcorp Posted September 29, 2011 Author Share Posted September 29, 2011 Lee Mac, I would like to apologize for my attachment. Lesson learned. Thank you for your help. I am trying to read up on writing my own LISP scripts, but it might take a couple of weeks to start understanding a lot of the language so you quick response is appreciated. Thanks again! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 29, 2011 Share Posted September 29, 2011 I would like to apologize for my attachment. Lesson learned. Thank you for your help. I am trying to read up on writing my own LISP scripts, but it might take a couple of weeks to start understanding a lot of the language so you quick response is appreciated. Thanks again! Not a problem rmjcorp, no need to apologise Quote Link to comment Share on other sites More sharing options...
SLW210 Posted September 29, 2011 Share Posted September 29, 2011 rmjcorp, Please Read THE CODE POSTING GUIDELINES and edit your second post containing a code snippet. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.