Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
The attached lsp puts tick marks at equal distances along a line/polyline and tags them with the distanace value from the start point. I draw using millimeter units but things like chainage should be displayed in meter units. Using this routine displays the values in millimeter units which I then 'find and replace' to edit their values to meters.
Can someone take a look at the lisp to see if it can be altered to input the mm value at the start but output the meter value to the text values?
Attached jpg graphically shows my request.
Regards
Sean
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
For you TEXT creation, line:
(list (cons 1 (rtos chainage 2 3)))
could be changed;
to something like;
(list (cons 1 (strcat (rtos (/ chainage 1000.0) 2 3 ) "m " ) ) )
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sean.keohane wrote:.... I draw using millimeter units but things like chainage should be displayed in meter units. Using this routine displays the values in millimeter units which I then 'find and replace' to edit their values to meters.
....
You should be able to do it by changing this line:
(list (cons 1 (rtos chainage 2 3)))
to something like this:
(list (cons 1 (strcat (rtos (/ chainage 1000) 2 1) "m")))
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks very much to both of you, that worked perfectly.
I appreciate your help,
Regards,
Sean
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have used the lisp discussed above but unfortunately the label (0+050.00, 0+100.00, etc) doesn't show, only the tick.
Also, I have seen drawings that has a tick interval of 50m but the label is placed only every 100m. The tick length on the place where there is label is longer that the one without label. Can you please reconfigure the above lisp so it would fit in my description?
Thank you in advance.
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
bulutok wrote:I have used the lisp discussed above but unfortunately the label (0+050.00, 0+100.00, etc) doesn't show, only the tick.
Also, I have seen drawings that has a tick interval of 50m but the label is placed only every 100m. The tick length on the place where there is label is longer that the one without label. Can you please reconfigure the above lisp so it would fit in my description?
Thank you in advance.
Text Style issues, you can use a existing textstyle name
....
(list (cons 50 (+ bearing PI))) (list (cons 7 "YourTextStyle" )) '((41 . 1.0) (51 . 0.0) (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 0) )
....
)
or remove it altogether . which will use the current TEXTSTYLE
HTH
EDIT: Almost forgot, for your format
...
(list (cons 1 (strcat "0+" (rtos chainage 2 2))))
...
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you very much for the swift reply.
I have used your latest suggestion but it didn't work out as I expected.
I wanted to remove the "m" on the suffix of each label. The label on the starting point (0+000.00) doesn't show.
Labels should look like this:
0+000.00
0+050.00
0+100.00
0+150.00
etc.
Also, the increment that I have entered is 50m. Why is it that the label doesn't have a 50m interval?
Please have a look on the attached jpeg file in order to have a clear idea on what I wanted.
Thanks again.
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
bulutok wrote:Thank you very much for the swift reply.
I have used your latest suggestion but it didn't work out as I expected.
I wanted to remove the "m" on the suffix of each label. The label on the starting point (0+000.00) doesn't show.
Labels should look like this:
0+000.00
0+050.00
0+100.00
0+150.00
etc.
Also, the increment that I have entered is 50m. Why is it that the label doesn't have a 50m interval?
Please have a look on the attached jpeg file in order to have a clear idea on what I wanted.
Thanks again.
works fine here in 2009
(defun c:Chainage (/)
(vl-load-com)
(defun _Line (p b o)
(entmake
(append
'((0 . "line")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "C_Chainage")
(100 . "AcDbLine")
)
(list (cons 10 (polar p b o)))
(list (cons 11 (polar p (+ b PI) o)))
'((210 0.0 0.0 1.0))
)
)
)
(defun _text (p b o h c)
(entmake
(append
'((0 . "TEXT")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "C_Chainage")
(100 . "AcDbText")
)
(list (cons 10 (polar p (+ b PI) (* o 2.0)))
)
(list (cons 40 h))
(list (cons 1 (strcat "0+"
(if (setq ld (nth (strlen (rtos c 2 0)) '(x "00" "0")))
ld "")
(rtos c 2 2))))
(list (cons 50 (+ b PI)))
'((41 . 1.0)
(51 . 0.0)
(71 . 0)
(72 . 0)
(11 0.0 0.0 0.0)
(210 0.0 0.0 1.0)
(100 . "AcDbText")
(73 . 0)
)
)
)
)
(defun _ang (p1 p2)(+ (angle p1 p2) (/ PI 2.0)))
(setq dist (getdist "Type in chainage increment: "))
(setq offset (getdist "Type in tick size: "))
(setq height (getdist "Type in iso text height: "))
(setq ss (ssget)
count 0
dist dist
offset offset
height height
)
(repeat (sslength ss)
(setq ent (ssname ss count)
obj (vlax-ename->vla-object ent)
chainage dist
)
(_line (setq p (vlax-curve-getstartpoint obj))
(setq bearing (_ang p (vlax-curve-getPointAtDist obj (+ chainage 0.001))))
offset)
(_text p bearing offset height 0.0)
(while
(and
(setq point1 (vlax-curve-getPointAtDist obj chainage))
(setq point2 (vlax-curve-getPointAtDist obj (+ chainage 0.001)))
)
(setq bearing (+ (angle point1 point2) (/ PI 2.0)))
(_line point1 bearing offset)
(_text point1 bearing offset height chainage)
(setq chainage (+ chainage dist))
)
(setq count (1+ count))
)
)
HTH
BTW: what of the last point?
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Great! Works perfectly now.
This would be of great help and I will be forever grateful to you.
Thanks a lot and God bless!
Re: Measure in millimeter s but display values in meters...
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
bulutok wrote:Great! Works perfectly now.
This would be of great help and I will be forever grateful to you.
Thanks a lot and God bless!
You are welcome. even though this thread is a year ang change old the credit still goes to the original author sean.keohane
Cheers


