I have a lisp program that uses a 3dpoly to draw a profile of existing ground elevations. Currently, the program only writes in distances as whole numbers (ie:500 or 1600) I would like it to write them as stations along the profile (ie: 0+500 or 1+600) does anyone have a peice of code for doing this?
I run civil3d2012, but most of the rest of the office uses map3d2012
map3d2012 and civil3d2012
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
See also:
@FSJ_Mo wrote:I have a lisp program that uses a 3dpoly to draw a profile of existing ground elevations. Currently, the program only writes in distances as whole numbers (ie:500 or 1600) I would like it to write them as stations along the profile (ie: 0+500 or 1+600) ....
If the program already derives text strings representing integer values, and it's just a matter of converting them to stationing format, try incorporating something like this:
(defun station (num)
(while (< (strlen num) 4)
(setq num (strcat "0" num))
); while
(strcat
(substr num 1 (- (strlen num) 3))
"+"
(substr num (- (strlen num) 2))
); strcat
); defun
Usage:
Command: (station "500")
"0+500"
Command: (station "1600")
"1+600"
Command: (station "45")
"0+045"
Command: (station "123456")
"123+456"
Command: (station "1")
"0+001"
[You would presumably feed in a variable containing the text string, set as the result of what the other program works out, rather than text strings explicitly.]
If you ever need to go beyond six digits, that could be accomplished, but it would require adjustments.
@Kent1Cooper wrote:....If you ever need to go beyond six digits, that could be accomplished, but it would require adjustments.
That is, if numbers beyond six digits need additional plus signs in them, such as 1+234+567 [I don't know how these things work, being a mere Architect -- I'm just manipulating text here]. If such a value would ever be encountered but still needs only the one plus sign to separate the last three digits, then the routine works as posted:
Command: (station "1234567")
"1234+567"
@FSJ_Mo wrote:thanks for all the help guys!
You're welcome. Just for my own curiosity, do stationing numbers ever get to be 7 digits or more, and if so, would they need to have additional + signs separating groups of 3, like commas separating units from thousands from millions? I'd like to have a little more inkling of how they're used, since questions involving them come up here now and then.
We are a survey company servicing mostly the oil & gas industry in NE British Columbia and our projects are usually under 20Km long so we would have no need. A project would have to be over 1000Kms long before this would apply and typically a project of this length would be broken into smaller segments. IMO