Jump to content

How to change units or conversion factor in lsp file


rmjcorp

Recommended Posts

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 by rmjcorp
To give credit where credit is due
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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...