Jump to content

Commands of ACad Civil3D2013 not working well with LISP


Recommended Posts

Posted

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 :shock:

 

 

Can Someone help? :cry:

Posted

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.

Posted
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

-----------------------------------------------------------------

Posted

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))
 )
)

Posted
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!

Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...