command _fillet using osnap

command _fillet using osnap

Anonymous
Not applicable
2,348 Views
27 Replies
Message 1 of 28

command _fillet using osnap

Anonymous
Not applicable
Hello,
Once manual fillet command choose two entity points
may I use "_.fillet" command using osnap to set a getpoint position?

(setq ent1 (car (entsel "\nSelect Object1: ")))
(setq StartPoint_ent1 (vlax-curve-getStartPoint (vlax-ename->vla-object ent1))
(setq ent2 (car (entsel "\nSelect Object1: ")))
(setq EndPoint_ent2 (vlax-curve-getEndPoint (vlax-ename->vla-object ent2))

(setq pickset1 (ssadd))
(ssadd ent1 pickset1)
(command "ZOOM" "OBject" pickset1 "")
(command "_.fillet" (osnap StartPoint_ent1 "_nea") (osnap EndPoint_ent2 "_nea"))

I've used this before with success but, now the result is always nil




 

0 Likes
Accepted solutions (2)
2,349 Views
27 Replies
Replies (27)
Message 2 of 28

ВeekeeCZ
Consultant
Consultant

If I comment out the ZOOM line, it works for me.

0 Likes
Message 3 of 28

devitg
Advisor
Advisor

 You LOST close parenthesis at 

 

(setq StartPoint_ent1 (vlax-curve-getStartPoint (vlax-ename->vla-object ent1))

and , at  

(setq EndPoint_ent2 (vlax-curve-getEndPoint (vlax-ename->vla-object ent2))

 

0 Likes
Message 4 of 28

Anonymous
Not applicable

Really works.

 

The problem happens when there are other objects (polylines) closest of the StartPoint_ent1 and EndPoint_ent2. So, it can use the wrong lines to fillet. How can I force "fillet" command using osnap, to use ent1 and ent2 only.

 

Please use the attached example, where fillet should happend on the white lines and not in the purple ones. 

 

Important: in the real situation the lines are at the same layer and color.

0 Likes
Message 5 of 28

Anonymous
Not applicable

I think that is related of the creation order of the lines, AUTOCAD uses the latest ones in the fillet command.
I've just simulate creating the purple lines first and left white ones as latest created and it works fine.
So, I need to cheat autocad to get the lines I want and not the latest ones.

 

Not sure about it anymore, probably is because the lines are near.

 

I did more tests and it seems the AUTOCAD uses the latest lines indeed.

0 Likes
Message 6 of 28

devitg
Advisor
Advisor

Please try it , 

 

(Setq sel1 (entsel "\nSelect Object1: "))
(setq ent1 (car sel1))
(setq pt1 (cadr sel1))
(setq pt@ent1 (vlax-curve-getclosestpointto (vlax-ename->vla-object ent1) pt1))
(Setq sel2 (entsel "\nSelect Object2: "))
(setq ent2 (car sel2))
(setq pt2 (cadr sel2))
(setq pt@ent2 (vlax-curve-getclosestpointto (vlax-ename->vla-object ent2) pt2))
(command "_.fillet" pt@ent1 pt@ent2)

0 Likes
Message 7 of 28

Anonymous
Not applicable

Thanks for the try but the FILLET command should happend to the smallest parts of the segmentes ent1 and ent2, that's why I am forcing to use StartPoint_ent1 and EndPoint_ent2.

0 Likes
Message 8 of 28

devitg
Advisor
Advisor

So , pick at the short side of the white poly . 

 

0 Likes
Message 9 of 28

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

....The problem happens when there are other objects (polylines) closest of the StartPoint_ent1 and EndPoint_ent2. So, it can use the wrong lines to fillet. How can I force "fillet" command using osnap, to use ent1 and ent2 only.

....


 

I haven't tried it in FILLET, but I know in [for example] LENGTHEN this works when other things are right there and might be "seen" instead of what is wanted:

 

Instead of giving it just a point, give it a list of an entity name and a point, the same as what is returned by (entsel).

Kent Cooper, AIA
Message 10 of 28

Anonymous
Not applicable

I cannot pick a point manually.
The lisp program should do it automatically, the idea its run over on hundreds of polylines without user interference.
So, StartPoint_ent1 and EndPoint_ent2 are my "pick points".

0 Likes
Message 11 of 28

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

you can not relay on start point\end point of the line\polyline if it be reversed, your lisp would not work.

 

moshe

 

 

 

0 Likes
Message 12 of 28

Anonymous
Not applicable

Looks like a good idea!

How should be the correct syntax for that?
in other words... how can I make this list using the entities names and just one point (my choice of the pick point) for each entity?

0 Likes
Message 13 of 28

Anonymous
Not applicable

Well, in this case I know the order the lines were created.

0 Likes
Message 14 of 28

Moshe-A
Mentor
Mentor

what is the advantage of using a lisp here? you asking the user to select the 2 objects, isn't running the native fillet command enough?

 

if you are not counting on the user to pick the objects on the right spots, you could find the intersection of the 2 objects, than take the 2 close ends to the intersection (assuming the other end is far enough) and let fillet to pick the the right spot in-between - NO?

 

moshe

 

 

0 Likes
Message 15 of 28

ВeekeeCZ
Consultant
Consultant

Here is some example...

 

(if (setq ss (ssget))
    (command "_.FILLET" (cons (ssname ss 0) (list (trans (vlax-curve-getStartPoint (ssname ss 0)) 0 1)))
             	        (cons (ssname ss 1) (list (trans (vlax-curve-getStartPoint (ssname ss 1)) 0 1)))))
Message 16 of 28

devitg
Advisor
Advisor

There is a big difference between the post , and the task to do, also it is lack of show the real environment where the

lisp have to work . 

If the OP could show the TRUE and real  DWG , maybe it can be done. 

Maybe the HANDLE  could be use , as he say he know the order acad make the ent.

 

 

 

 

 

0 Likes
Message 17 of 28

devitg
Advisor
Advisor
(setq ss (ssget)

Means user input, too 

0 Likes
Message 18 of 28

ВeekeeCZ
Consultant
Consultant

@devitg wrote:
(setq ss (ssget)

Means user input, too 


 

Psss.. you shouldn't say it out loud. That supposed to be a little secret.

0 Likes
Message 19 of 28

Anonymous
Not applicable

this is a little bit funny already... 🙂

I was just trying to simplify a question... and sure I can change a user input example to something else

0 Likes
Message 20 of 28

Anonymous
Not applicable

 

I've tried this with no success

(command "_.fillet" (cons ent1 (list (trans (list (car StartPoint_ent1) (cadr StartPoint_ent1)) 1 0) ))
                                   (cons ent2 (list (trans (list (car EndPoint_ent2)   (cadr EndPoint_ent2)) 1 0) ))
        )

and this

(command "_.fillet" (cons ent1 (list (osnap (trans (list (car StartPoint_ent1) (cadr StartPoint_ent1)) 1 0) "nea")))
                                   (cons ent2 (list (osnap (trans (list (car EndPoint_ent2) (cadr EndPoint_ent2)) 1 0) "nea")))
       )

result is ; error: Function cancelled

0 Likes