calculation

calculation

Gaganpatel
Collaborator Collaborator
3,528 Views
29 Replies
Message 1 of 30

calculation

Gaganpatel
Collaborator
Collaborator

 

Dear Sir,

I want calculation auto lisp program. out put text are attributes block.

Please find the attachment.

 

0 Likes
Accepted solutions (1)
3,529 Views
29 Replies
Replies (29)
Message 2 of 30

Gaganpatel
Collaborator
Collaborator

 

Please Replay any body

0 Likes
Message 3 of 30

Kent1Cooper
Consultant
Consultant

If you're just looking for the AutoLisp-function equivalents of those formulas [untested]:

 

(setq

  1stSlope (sqrt (+ (expt Altitude 2) (expt Base 2)))

  2ndSlope (sqrt (+ (expt 1stSlope 2) (expt Base 2)))

  TSlopeTanB (/ Base Altitude)

  2TanB (* TSlopeTanB 2)

  Face (/ 1stSlope Altitude)

  Dev (/ 2ndSlope Altitude)

  FSlopeTanB (/ Base 1stSlope)

  SecB (/ Dev Face)

)

 

Variable names can't have spaces in them, so I collapsed some of them, and I differentiated between the two Tan B varieties with prefixes.

 

Those are all still numbers, to be able to use them in calculating the other values.  To use them as Block Attributes, they need to be converted to text strings, using (rtos) functions:

 

(rtos 1stSlope 2 4)

(rtos 2ndSlope 2 4)

(rtos TSlopeTanB 2 9)

(rtos 2TanB 2 9)

(rtos Face 2 9)

(rtos Dev 2 9)

(rtos FSlopeTanB 2 9)

(rtos SecB 2 9)

 

Look into the DIMZIN System Variable to control leading and trailing zeros.  It looks like you want leading zeros, but I suspect the only way to get your four  leading zeros for the slope figures will be to "pad" the front of them, adding more zeros with (strcat) functions.  The other figures all have 9 decimal places except the last with 8, which suggests that particular value would have a 0 at the end if it were 9 decimal places, and you don't  want trailing zeros for those.

 

[I would also suggest you consider whether 9 decimal places really serve any practical purpose -- I would think you could get by with a lot fewer than that.]

Kent Cooper, AIA
0 Likes
Message 4 of 30

Gaganpatel
Collaborator
Collaborator

Dear Sir,

Output data not attributes block only text.

provided how to use

0 Likes
Message 5 of 30

Gaganpatel
Collaborator
Collaborator

 

Please reply sir

0 Likes
Message 6 of 30

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

Variable names can't have spaces in them, so I collapsed some of them, and I differentiated between the two Tan B varieties with prefixes. (no spaces required)

 

Those are all still numbers, to be able to use them in calculating the other values.  To use them as Block Attributes, they need to be converted to text strings, using (rtos) functions: (attributes block not required only text required)

 

The other figures all have 9 decimal places except the last with 8, which suggests that particular value would have a 0 at the end if it were 9 decimal places, and you don't  want trailing zeros for those. (8 decimal)

0 Likes
Message 7 of 30

Kent1Cooper
Consultant
Consultant

@Gaganpatel wrote:

Dear Sir,

Output data not attributes block only text.

provided how to use


Well, that's a direct contradiction to both Message 1 and  the image.  It would be a lot easier to use  if that chart at the bottom of the image were a Block with Attributes.  A routine could just Insert the Block and, all within the same INSERT command, just feed in the text content for each Attribute in order.  If they're separate Text objects, it would have to calculate the location for each, and specify the justification and style and height and so on.  And would it also have to create the label/heading Text parts, not just the calculated numerical values, or would those already be in the drawing?

 

Another question:  Where would the input Base and Altitude values come from, that all the calculations are based on?  Would the User be asked to type them in?  Or to pick points on-screen?  Or to select some object(s) that the routine would extract them from?  If so, what kind(s) of object(s)?  Or would they be in some external file such as a spreadsheet?  Or something else?

Kent Cooper, AIA
0 Likes
Message 8 of 30

Gaganpatel
Collaborator
Collaborator

 

altitude value or base value typing.

output data text

0 Likes
Message 9 of 30

Kent1Cooper
Consultant
Consultant

@Gaganpatel wrote:

 

Please reply sir


[Please develop a little patience.  14 minutes is a ridiculously short time to wait before prodding again for a reply, and for that matter, less than an hour up at the top is pretty short, too.  People are not just sitting around watching for things to come in here.  I happened to be on, and could reply, but consider that for many Users around the world, it's the middle of the night now, etc.]

Kent Cooper, AIA
Message 10 of 30

Gaganpatel
Collaborator
Collaborator

ok Good Night Sir,

Wait for your replay tomorrow.

0 Likes
Message 11 of 30

Gaganpatel
Collaborator
Collaborator

dear sir,

please any answer

0 Likes
Message 12 of 30

Gaganpatel
Collaborator
Collaborator

Please replay Sir

0 Likes
Message 13 of 30

Gaganpatel
Collaborator
Collaborator

Dear Sir,

 

I want to calculation lisp

Please help

0 Likes
Message 14 of 30

DannyNL
Advisor
Advisor

You do realize that by posting multiple messages and requests for help in a short time and by not waiting if someone replies, you are only annoying people and probably just accomplish that they do not want to help you? Smiley Frustrated

 

You'd contacted me earlier this week with a direct message before creating this post, with the same question. And after pointing out that I normally do not respond to direct requests (I receive a lot of those sometimes and do not have the time for them), I already did provide you with the code to do the base calculation.

After you got that code you added an additional question to automatically fill an attributed block with the calculated values, so basically the same as what you are asking here. At that point I told you I did not have the time and I would not respond to any of your direct messages anymore. And if you needed further assistance you should post a question on the forum.

 

However, looking at this post on the forum you did not mention the code that I provided to you as a starting point, thus making people believe you didn't have anything yet. And so people started writing new code for the base calculation.

 

You do realize this forum runs on users helping other users and this is not some kind of programming factory that spits out code whenever you ask it too. Also a lot of people helping here probably have their day time job as well, besides looking and posting on this forum as well. And that the users that are writing code are located over the whole world, so there is also an issues of something called different time zones? 

 

By not providing the full and complete information in the beginning of your post, you are only delaying a possible solution yourself. So stop posting multiple messages in a row asking for help and wait patiently until someone has the time to respond and wants to help you! 

Message 15 of 30

Gaganpatel
Collaborator
Collaborator

Dear Sir,

As per your calculation i found that my result is wrong.

I need the output result in text or attributes block in decimal 8 digit.

Please check your programing and my calculation either matching or not.

Please find the attachment of your programing and my calculation.

 

0 Likes
Message 16 of 30

Kent1Cooper
Consultant
Consultant

@Gaganpatel wrote:

.... my result is wrong. ....

Please check your programing and my calculation either matching or not.

.... 


 

I suspect this needs to be corrected:

 

         (princ (setq S_Slope1 (sqrt (+ (* S_Altitude  2) (* S_Base 2)))))
         ....
         (princ (setq S_Slope2 (sqrt (+ (* S_Slope1 2) (* S_Base 2)))))

 

Not twice  the Altitude and Base, but the square  of those values [see my first Reply, using different variable names]:

 

         (princ (setq S_Slope1 (sqrt (+ (expt S_Altitude  2) (expt S_Base 2)))))
         ....
         (princ (setq S_Slope2 (sqrt (+ (expt S_Slope1 2) (expt S_Base 2)))))

 

[And by the way, @Gaganpatel, it's "reply," not "replay" as you have sometimes spelled it -- "replay" is  also an English word, with a completely unrelated meaning.]

Kent Cooper, AIA
0 Likes
Message 17 of 30

Gaganpatel
Collaborator
Collaborator

Dear Sir,

I do not auto lisp programing.

i have send you calculation example file. Please solve

0 Likes
Message 18 of 30

Gaganpatel
Collaborator
Collaborator

 

Dear Sir,

 

Please solve

0 Likes
Message 19 of 30

pbejse
Mentor
Mentor

@DannyNL wrote:

 

You'd contacted me earlier this week with a direct message before creating this post, with the same question.


One of many DannyNL  Smiley Happy. Told the OP to post the request on the discussion board, My guess is i'm not the only one who did.

Message 20 of 30

Gaganpatel
Collaborator
Collaborator

Dear Sir,

can be input the flowing item in model space by entering the altitude and base value.

1. 1st Slope

2.2nd Slope

3.Tanb

4.2TanB

5.Face

6.Dev

7.TanB

8.SecB

** i want output data in auto cad text or attributes from.

0 Likes