Jump to content

Lisp to Create Polyline at Middle of Every 2 Selected Lines & Auto Chamfer To Form A Continuous Polyline


JCYK

Recommended Posts

Hi @hanhphuc, thank you very much for sharing your awesome lisp. Indeed it will help reduce the work load! Is it possible to allow select more than one layer so that I can also select the window lines at one go for example?

 

Thank you in advance!

 

 

 

 

Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • JCYK

    8

  • BIGAL

    6

  • Dani_Nadir

    4

  • hanhphuc

    3

Top Posters In This Topic

Posted Images

20 hours ago, JCYK said:

Hi @hanhphuc, thank you very much for sharing your awesome lisp. Indeed it will help reduce the work load! Is it possible to allow select more than one layer so that I can also select the window lines at one go for example?

 

Thank you in advance!

 

 

It was ugly code years ago. i'm glad it helps :)

The reasons i explicitly using different layer selection due to parity is important in order to make it work,

because we don't know how efficient a draft person's line work, sometimes mass up in different layers, overlap lines etc..

If you select all lines without filter it may yield unexpected result.

You may think it's simple job manually chamfer extend & trim, but in programming it's quite tricky that's why we need some fuzz tolerance perhaps requires AI solutions? :)

eg: if a wall has a square dimension 100x100, who to tell CAD to put center line horizontally or vertically ?

Noting that the window & wall has different thickness, i.e you can't apply wall's fuzz factor on windows too.

 

my attempt automation seems to be working in your dwg but glitches at window part. since i've started working at office now so can't spend too much time.

it's just start point however you have to trial error in working with different dwgs

 

 

Here's workround 

dpyD79o.gif

 

see also this optimization 

 

p/s: @marko_ribar also has many useful tools for polyline

 

 

 

Edited by hanhphuc
typo
Link to comment
Share on other sites

Hi @hanhphuc, thank you for explaining and the suggested workaround. I fully agree the selection needs to be very careful and not to have other elements to affect the program. For my situation the floor plans can have at least 3 different layers of parallel lines involved that I need to create middle line. That means I'll need to run the lisp at least 3 times or change all of them to a same layer which is not preferable. 

 

I'm thinking it will help a lot if I can just need to run the lisp once and able to select all those parallel lines that I need (i.e. no need to be constraint to one layer). To avoid other elements being selected accidentally what I can do is isolate the 3 layers involved prior running the lisp. In terms of the 'ignore short length' it's not a problem too as the length I specify can applies to all.

 

Hence it would be very helpful if the lisp can be modified as above. 🙏

 

Thank you!

Link to comment
Share on other sites

why not trial & error to suit your needs?  

key words in red

 

(setq *sd*  300 ) ; eg: 300 is the preset fuzz depends on your scale

(if T
(and (setq e (car (entsel "\nPick matched layer entity..")))
   (setq _layer (cdr (assoc 8 (entget e))))
   ) ;_ end of and
   (setq sd *sd*   (getdist
    (strcat "\nIgnore short length, approx < Between 0.0 to " (rtos *sd* 2 3) " > ? : ")
    ) ;_ end of getdist
  m

;;<snippet> ;;

     ) ;_ end of list
 _layer "*" ; <--- Picked Layer 

not tested. 

another suggestion you can qselect & filter short line in different layer

 

p/s: you'll get bunch of bugs if breaking the fuzz rules :)

 

 

 

Link to comment
Share on other sites

Hi, sorry that I don't know how to write a lisp code. Will be grateful if there's someone can help on this. 🙏

 

Thank you!

Link to comment
Share on other sites

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