Jump to content

Recommended Posts

Posted

I know that I am making a stupid mistake, but I am wondering why my code to select the just created object after the break command doesn't work. I have tried using different combinations of entget with entlast, but it just doesn't seem to work. My code is:

(setq ent1 (entget (entlast)));;;I have also tried (car (entget (entlast))) and (entget (car (entlast))) but it doesn't work either.
      (vl-cmdf "._join" ent ent1 "")

Where ent is the object selected that I ran the break command on. This is part of a bigger routine, which is why I am trying to break and then rejoin the pline.

Posted

Looks right to me, except this question:

Whats the quote for the "ent" expression? - does it have entget ?

Posted

You need at 1st pick to save the object ID then do break entlast will be the new object.

Posted

So the ent is assigned is assigned to

(setq ent (car (entsel "\nSelect object to break and join: ")))

Is this incorrect as well?

Posted

I am not sure but you could try:

(vl-cmdf "._join" (entget ent ) ent1 "")

where:

(setq ent1 (entget (car (entlast))))

Posted

So I tried that and it still isn't working. I'm wondering if maybe the object id is changed so that the original object doesn't exist anymore and instead there are two new id's.

Posted

I was thinkink that join command might work with selection set, so maybe constructing an empty ss, where those both are added into it might work.

Posted

If I may. Why don't you use the command Pedit instead?

 

As described into your first post that you selected a polyline and ran the command break then after that you used entlast function to get the polyline divided and that is not enough to get the newly created piece of curve object.

 

When you firstly selected the polyline to break and after running the command break and it is done just write codes using while function with entnext to retrieve the newly created objects.

 

Good luck.

Posted
If I may. Why don't you use the command Pedit instead?

 

As described into your first post that you selected a polyline and ran the command break then after that you used entlast function to get the polyline divided and that is not enough to get the newly created piece of curve object.

 

When you firstly selected the polyline to break and after running the command break and it is done just write codes using while function with entnext to retrieve the newly created objects.

 

Good luck.

I am not using PEDIT because this is part of a larger routine involving feature lines that will be broken and then rejoined using the same technique instead of inserting a PI using the command because it can mess up the slopes of the feature lines. I hadn't thought of using the entnext function to accomplish this. I'll mess around with it and see what I can do. Thanks for the help and suggestions!
  • 2 weeks later...
Posted

Tharwat, so I have tried to use your method, but it says that I have an empty selection set, which seems weird because there should be at least one new entity. My code is:

(setq lastent (entlast))
      (command "._AeccBreakFeatures" ent "_f")
      (princ "\nPick break point: ")
      (command pause "@")
      (while (setq lastEnt (entnext lastEnt))
        (ssadd lastEnt ss)
      )

Posted

Hi,

 

I don't know about C3D so I tried my method in AutoCAD 2009 and it does have only the new created piece that left off from the implementation of break command, so it works here.

Posted

So I think I must have something wrong with how I am incorporating it then because I tried it with just a normal polyline and it still gives me the error "Error: bad argument type: lselsetp nil". I have looked through my code and I still can't figure it out. Thank you so much for helping me with this! My code with the normal break command is :

((setq pt (getpoint "\nPick break point: "))
      (setq lastent (entlast))
      (vl-cmdf "_.break" ent "_f" "_non" pt "_non" pt)
      (while (setq lastEnt (entnext lastEnt))
        (ssadd lastEnt ss)
      )
     )

Posted

Give this a go:

 

(setq ss      (ssadd)
     lastent (entlast)
     pt      (getpoint "\nPick break point: ")
     )
(vl-cmdf "_.break" "\\" "_f" "_non" pt "_non" pt)
(while (setq lastent (entnext lastent))
 (ssadd lastent ss)
 )
(sssetfirst nil ss)

Posted

Broncos,

 

I believe your problem arise when you are breaking a close entity.

 

When this is the case (entlast) will return you the wrong entity

since no new entity was created by the command.

 

So you probably need to test to know if you starting entity is

a closed one (circle, ellipse, polyline)

 

entlast Returns the name of the last nondeleted main object (entity) in the drawing

 

ymg

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