atuan_free Posted June 21, 2014 Posted June 21, 2014 Hi EveryBody. I have a problem with a simple code as below: (setq myOb (ssget)) (command "ADDSEGMENTLABEL" myOb "") ;---> not working But the code below: (setq myOb (ssget)) (command "._erase" myOb "") ;--> work well Can Someone help? Quote
BIGAL Posted June 23, 2014 Posted June 23, 2014 Pretty easy answer ssget is select multiple, erase supports a multiple answer, addsegmentlable expects a single entity you will need to loop through the selection set. Use repeat or foreach. Quote
atuan_free Posted June 23, 2014 Author Posted June 23, 2014 Pretty easy answer ssget is select multiple, erase supports a multiple answer, addsegmentlable expects a single entity you will need to loop through the selection set. Use repeat or foreach. Thank You Bigal, but I tried the other simple as below: (setq pline (entsel)) (setq plEnt (car pline)) (command "ADDSEGMENTLABELS" plEnt) Or. (command "ADDSEGMENTLABELS" (car pline)) Got the same problem: ---------------------------------------------------------------- Command: (command "ADDSEGMENTLABELS" (car pline)) ADDSEGMENTLABELS Adds labels for all segments of polylines, feature lines, lines, and arcs, parcels and alignments. Labels are placed at mid point of each segment. Adds labels for all segments of polylines, feature lines, lines, and arcs, parcels and alignments. Labels are placed at mid point of each segment. Select Entity: Command: nil ----------------------------------------------------------------- Quote
rkmcswain Posted June 23, 2014 Posted June 23, 2014 The ADDSEGMENTLABEL and ADDSEGMENTLABLES command each expect a POINT, not an ENTITY. The following works with LINES, ARCS, and POLYLINES. (defun c:foo () (setq sset (ssget) i 0) (repeat (sslength sset) (setq item (ssname sset i)) (setq obj (vlax-ename->vla-object item)) (setq mid_pt (vlax-curve-getpointatdist obj (/ (vlax-curve-getdistatpoint obj (vlax-curve-getendpoint obj)) 2.0))) (vl-cmdf ".aeccaddsegmentlabels" mid_pt "") (setq i (1+ i)) ) ) Quote
atuan_free Posted June 24, 2014 Author Posted June 24, 2014 The ADDSEGMENTLABEL and ADDSEGMENTLABLES command each expect a POINT, not an ENTITY. The following works with LINES, ARCS, and POLYLINES. (defun c:foo () (setq sset (ssget) i 0) (repeat (sslength sset) (setq item (ssname sset i)) (setq obj (vlax-ename->vla-object item)) (setq mid_pt (vlax-curve-getpointatdist obj (/ (vlax-curve-getdistatpoint obj (vlax-curve-getendpoint obj)) 2.0))) (vl-cmdf ".aeccaddsegmentlabels" mid_pt "") (setq i (1+ i)) ) ) Wow!. It runs very good. so we must use ActiveX. thank you Rkmcswain! Quote
BIGAL Posted June 25, 2014 Posted June 25, 2014 Rkmcswain took a little while to figure out the "vlax-curve-getdistatpoint" this will return a vertice say versus "/ vla-get-length obj 2" which returns a pt 1/2 way along the pline. may be usefull for other things. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.