Polyline Labels - Math Formula


ComputerMaster86
 Share

Recommended Posts

I am working with polyline boxes in Chief Architect X8 and their labels.  I have noticed how you can add labels like %visible_length%, which gives the length of the line of the whole box.  My question has to do with using %visible_length% in a math formula.  Is their a way to type a math formula in the box under "Specify Label" in the "Polyline Specification" dialogue box that displays the answer of the math formula as the label for the polyline. My idea is to right a math formula that takes %visible_length% and subtracts 72" and then divides that value by 2?  I guess my general question is can you even add math formulas to these labels like you type a math formula in MS Excel and the answer of the formula is displayed in the cell?

post-8172-0-42392200-1457727880_thumb.jpg

Link to comment
Share on other sites

Man! Ruby is great!  :)  I think I may have made my work a little easier, when doing 2D steel layouts for my boss.  I normally draw these up in a program called TurboCAD, which is along lines of AutoCAD.  I recently started experimenting with CA.  You got me hooked on learning ruby.  Now if I can write some Ruby code to generate a list of all the polyline labels.  That would literally be like "mind blown!"

 

post-8172-0-03863800-1457756237_thumb.jpg

Link to comment
Share on other sites

Joe, how do you add this to that script so you can round the last number to 2 digits. I know this have to be added to the script but how do you add that?  "round (2)" 

 

Thanks!

result = (owner.visible_length-72)/2

result = result.round(2)

 

or

 

result  =  ((owner.visible_length-72)/2).round(2)

 

To use any "Ruby Method" just use a "." before it.  That tells Ruby that the following is a modifier.

Link to comment
Share on other sites

Joe, one more question please. If I use pLines and I connect lets say 3 or 4 together, instead of getting total SQFT area, how do I code a macro to get the total length of all pLines?

That get's much more complicated.  You need a way to accumulate and store the values for each Polyline.  This can be done using Ruby Global Variables.

 

I have a macro package called "Hash Areas" that I sell for $25 that does this for the areas.  I consists of several macros, one to collect the data and others to perform calculations and display results.  I spent a lot of time figuring how to do it and create the macros.  The functionality is well worth the price and by studying the macros you can learn a lot ;)

 

This same system can easily be modified to use for "Total Length" instead of "Areas"

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share