multiple offsets of different dimension and trim

multiple offsets of different dimension and trim

Anonymous
Not applicable
3,705 Views
16 Replies
Message 1 of 17

multiple offsets of different dimension and trim

Anonymous
Not applicable

I have gone through the offset lisps listed in this group.

I'm looking for a lisp to offset line at different distances from sides and then trim them.

think of a hexagon, but it could be more than 6 sides, or less,  not the same length, each with a different offset.

The offsets will need to be trimmed or filet 

 

Any ideas?  from my reading it will have to be a get function....

0 Likes
Accepted solutions (1)
3,706 Views
16 Replies
Replies (16)
Message 2 of 17

pendean
Community Legend
Community Legend
Show us what you mean; post a bunch of sample images of source and final result you want.

0 Likes
Message 3 of 17

scot-65
Advisor
Advisor
I think INTERS is your friend here.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 4 of 17

Kent1Cooper
Consultant
Consultant

Perhaps you can use OFFPOLY1.lsp with its OP1 command, available >here<.  It Offsets a single segment of a Polyline, and "fixes" adjacent segments accordingly in Fillet-like rather than Stretch-like adjustment.  You would do each segment by whatever distance and direction it needs.

Kent Cooper, AIA
0 Likes
Message 5 of 17

Anonymous
Not applicable

sorry, been busy.....here is a simple rectangle...the white sides are offset different dimension inwards, the red lines,  and then trimmed .  the offset will differ, the number of sides will differ.example.png

0 Likes
Message 6 of 17

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....here is a simple rectangle...the white sides are offset different dimension inwards, the red lines,  and then trimmed .  the offset will differ, the number of sides will differ.


 

So now it occurs to me to wonder....  The OP1 command in OffPoly1.lsp will do that, but only if the rectangle is a Polyline, not if separate Lines, and  it will not make a copy, but will alter the original Polyline.  Do you want both  your white and your red in the end result?  OP1 could presumably be edited to ask whether you want the adjustment done to a copy, leaving the original as is, which option you could choose for the first edge adjustment, and then do the adjustments of the other edges on that new one, without  the do-it-to-a-copy option [or you'd end up with as many Polylines as you have edges, all with only one edge adjusted].

Kent Cooper, AIA
0 Likes
Message 7 of 17

Anonymous
Not applicable

No, I need the white to stay where it is.  it may not be a polyline.

the red would be new.

0 Likes
Message 8 of 17

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

....  it may not be a polyline. ....


 

That "may not" could be a problem....  If it's Lines, try this [which will not  work if it's a Polyline, as OP1 will].  It doesn't use Fillet, but has the same effect.  You can Offset the sides inward or outward or a combination, and any number of sides until you hit Enter to finish.

 

Keep an eye on the command prompt line for what it's asking for, specifically the Offset distance for each edge and the side to which to Offset it.  [Unfortunately, because of the nature of doing Offsets in a (command) function, you don't get to "see" the result on the given side before you pick there.]

 

Depending on the configuration, and the relationship of the Offset distances to the size of the overall situation, some arrangements may not be able to be joined and cleaned up completely.

 

It also works if the edges are individual separate  Polylines, and if there are Arcs  among the edges, again with the caveat that in some arrangements it may not be geometrically possible to get a closed result.

 

It could be enhanced in assorted ways [in addition to the usual *error* handling and so on], such as to put the results on a different Layer [and create that if needed], to confirm that each thing selected is a Line or Arc so they can be joined in PEDIT, to disallow the Through option for the Offset distance if that should be disallowed, to set the PEDITACCEPT System Variable just in case [this assumes it's set to 1], to check that things are on unlocked Layers, to ask again for a missed pick or a wrong entity type, etc.

 

(defun C:OSFC ; = Offset Sides and Fillet Corners
  (/ lines fuzz lsel)
  (setq
    lines (ssadd); initially empty set
    fuzz 0
  ); setq
  (while
    (setq lsel (entsel "\nLine to Offset and include in new polygon <exit>: "))
    (redraw (car lsel) 3); highlight
    (command "_.offset" pause lsel pause ""); 1st pause for distance, 2nd for side
    (redraw (car lsel) 4); un-highlight
    (ssadd (entlast) lines); put result in set
    (setq fuzz (max fuzz (getvar 'offsetdist))); biggest Offset distance used so far
  ); while
  (command
    "_.pedit" "_multiple" lines "" "_join" (* fuzz 2) ""
      ;; hopefully big enough fuzz factor to catch all when outboard
    "_.explode" "_last" ;; <-- OMIT to leave as Polyline
  ); command
  (princ)
); defun 

 

Kent Cooper, AIA
0 Likes
Message 9 of 17

Anonymous
Not applicable

It does the offset nice, waiting for a distance and then select a line, but it doesn't trim them once they are inside.  they overlap, so they need a trim.

 

What I do now is offset the lines to a junk layer and then put a boundary on the inside of the overlapping lines and then freeze that layer and erase the offsets....

 

but this is a good start because it gets the multiple offsets and different distances right....

0 Likes
Message 10 of 17

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

..... it doesn't trim them once they are inside.  they overlap, so they need a trim. ....


 

It works for me.  I set up a situation analagous to your earlier image, and gave it aribtrarily distances of 1 through 4 units going CCW from the bottom edge around to the left edge, and it worked fine:

osfc.PNG

Are there any messages at your command line that could explain why it's not doing the same for you?

[And just to recap:  Is PEDITACCEPT set to 1, as the routine assumes as mentioned in the Message with the code?]

Kent Cooper, AIA
0 Likes
Message 11 of 17

Anonymous
Not applicable

Thank you!  it was the PEDITACCEPT =1 that made it work!  Thank you very much!

0 Likes
Message 12 of 17

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

Thank you!  it was the PEDITACCEPT =1 that made it work!  Thank you very much!


 

You're welcome.  If you don't always have it set to that value, you can build it into the routine, with:

 

(setvar 'peditaccept 1)

 

somewhere before the PEDIT command comes in.  If you would want it set back  if it wasn't initially at that value, saving and resetting can also be added.

Kent Cooper, AIA
0 Likes
Message 13 of 17

narasimharaoarza0211
Enthusiast
Enthusiast
Respected sir,
While using osfc lisp for inside offsetting, it will not properly closed and the triangle was crisscrossed. please give some solution.
0 Likes
Message 14 of 17

narasimharaoarza0211
Enthusiast
Enthusiast

osfc.jpeg

0 Likes
Message 15 of 17

Kent1Cooper
Consultant
Consultant

The Joining uses a Fuzz distance based on the Offset distances used.  I would guess that the loose ends in your image are just too far apart for that, probably as a result of the particular geometry.  It might work if you increase the fuzz distance, such as by changing this:

(* fuzz 2)

to use a greater multiplier:

(* fuzz 3)

 

Kent Cooper, AIA
0 Likes
Message 16 of 17

narasimharaoarza0211
Enthusiast
Enthusiast

osfc 1.jpgosfc 2.jpgosfc 2a.jpg

 

0 Likes
Message 17 of 17

narasimharaoarza0211
Enthusiast
Enthusiast

Sir Good evening,

In one example the value of fuzz was (* fuzz 10) succeeded

In second one the value of fuzz was (* fuzz 1000) not succeeded.

0 Likes