Need to result to be rounded to whole # - No decimal Places

Need to result to be rounded to whole # - No decimal Places

bobbyrubyii
Contributor Contributor
458 Views
2 Replies
Message 1 of 3

Need to result to be rounded to whole # - No decimal Places

bobbyrubyii
Contributor
Contributor
 (setq txt
                    (vlax-invoke spc 'addmtext ins 1.0
                        (strcat
                            "%<\\AcExpr (%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid (vlax-ename->vla-object ent)) ">%)."
                            (cond
                                (   (= "CIRCLE" typ) "Circumference")
                                (   (= "ARC"    typ) "ArcLength")
                                (   "Length"   )
                            )
                            " \\f \"" fmt "\">% + 10) \\f \"%lu5\">%'"
                        )
                    )
                )

This sometimes gives me results like 157 1/2' --- That is too detailed.  I need it to say 158' in that instance.

0 Likes
Accepted solutions (1)
459 Views
2 Replies
Replies (2)
Message 2 of 3

Ajilal.Vijayan
Advisor
Advisor

Hi,

Try with this.

Spoiler
 (setq txt
                    (vlax-invoke spc 'addmtext ins 1.0
                        (strcat
                            "%<\\AcExpr (%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid (vlax-ename->vla-object ent)) ">%)."
                            (cond
                                (   (= "CIRCLE" typ) "Circumference")
                                (   (= "ARC"    typ) "ArcLength")
                                (   "Length"   )
                            )
                            " \\f \"" fmt "\">% + 10) \\f \"%lu5\">%'"
                        )
                    )
                )
(vla-put-textstring txt(rtos(atof(vla-get-textstring txt))4 0))
0 Likes
Message 3 of 3

dbroad
Mentor
Mentor
Accepted solution

If you want the text object to remain a field, then replace

 

\\f \"%lu5\">%'

 

with

 

\\f \"%lu5%pr0\">%

 

Architect, Registered NC, VA, SC, & GA.