Extrim is not working properly!

Extrim is not working properly!

abbas.baghernezhad
Enthusiast Enthusiast
1,386 Views
11 Replies
Message 1 of 12

Extrim is not working properly!

abbas.baghernezhad
Enthusiast
Enthusiast

I need to use EXTRIM alot but I've discovered that this command sets an imaginary offset for trimming so it doesn't work all the time. Most surprisingly it would work for some other polylines in the same drawing.

I'm confused !

Here I have attached an example. here it works for the green polylines and doesn't work for the red one!

How can I solve this problem? Is there a macro to replace EXTRIM?

 

I just found out that there is a EXTRIM.lsp file in 

C:\Program Files\Autodesk\AutoCAD 2021\Express

Maybe editing this file can make that imaginary offset disappear or smaller! But I don't know anything about LISP!

0 Likes
1,387 Views
11 Replies
Replies (11)
Message 2 of 12

Ed__Jobe
Mentor
Mentor

I tried your example and I don't see any failure. Perhaps you can post a screenshot or better yet a video of how you are using EXTRIM. Use ScreenToGif to create a video.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 12

abbas.baghernezhad
Enthusiast
Enthusiast

I also tested the file on my computer at work with the same version of AutoCAD. I got different results. My computer at home needed the polylines to be more overlapped.  

abbasbaghernezhad_0-1704084236280.jpeg

 

0 Likes
Message 4 of 12

Ed__Jobe
Mentor
Mentor

The jpg helped. I was able to reproduce the problem. If you move the red pline down towards the center of the green pline, then the trim operation works. I briefly examined extrim.lsp, and there might be a limitation with it. However, I haven't worked with lisp in many years and so it would take me longer to see what the limitation is and if there is a solution. I will move this to the lisp forum to see if someone over there can help you. Keep in mind that this is supplied by Autodesk. So if you make any modifications to extrim.lsp, then you have to be careful that updates to the program don't overwrite your changes. Keep a backup.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 5 of 12

Sea-Haven
Mentor
Mentor

Inside Extrim.lsp is the function call (ETRIM you can use that directly rather than using the Extrim command, you just (load "Extrim") first have a look for it. 

This example uses a pline then the (getvar 'Extmax) to pick a point at extremes of the dwg. Ps plus a little bit more.

 

 

(load "Extrim")
(etrim (entlast) pmax)

 

 

 

0 Likes
Message 6 of 12

abbas.baghernezhad
Enthusiast
Enthusiast

Thank You.

I opened the EXTRIM.lsp and I searched for ETRIM .

I'm very new to lisp. SO as I realized I need to load EXTRIM first. (Isn't it already loaded? I don't understand how to do it.)

Then with 

(etrim (entlast) pmax)

I make some modification to the EXTRIM command, right?
I don't know how to do this either. 

Please explain more ! I need it.

0 Likes
Message 7 of 12

Sea-Haven
Mentor
Mentor

Try this

 

(If (not etrim)(load "Extrim"))
(setq ent (car (entsel "\nPick green pline ")))
(setq maxpt (getvar 'extmax))
(setq maxpt (mapcar '+ maxpt (list 1.0 1.0 0.0)))
(etrim ent maxpt)
Message 8 of 12

abbas.baghernezhad
Enthusiast
Enthusiast

Thank You.

The problem was with the The Red polyline! I need to edit my extrim.lsp some how that:

1- it doesn't ask for selecting entities. (doing the job  in a VBA for-next  loop.)

2-Always trims "Inside". (Doesn't ask for the second click)

3-It contains the modification you wrote.

So I could use it in my macro and save a lot of time. That would be very nice!

0 Likes
Message 9 of 12

Sea-Haven
Mentor
Mentor

2-Always trims "Inside". (Doesn't ask for the second click)

Try this for shapes where a centre point is inside note a "U" or "L" shape may not work.

(setq ptc (osnap (vlax-curve-getStartPoint obj) "gcen"))

 

Message 10 of 12

abbas.baghernezhad
Enthusiast
Enthusiast

We can offset inside the polyline and pick a Vertex. This works! no matter the polyline is convex or not. But I can't use this in VBA because we are using SendCommand and this way we can't use variables for vertex coordinates.

Can we do this in LISP?

0 Likes
Message 11 of 12

Sea-Haven
Mentor
Mentor

VBA can call a lisp and likewise a lisp can call a VBA. So use the Etrim as above. 

0 Likes
Message 12 of 12

abbas.baghernezhad
Enthusiast
Enthusiast

Thank you.

It took me a while to learn more about lisp commands... still learning.

I hope these line can solve my problem but i need to use extrim in reverse. I want to remove everything that is "Inside" my polylines!

The strange thing is that "extrim" works fine for green polyline but it does not for the red one. I can't trim everything inside the red one!

0 Likes