Jump to content

Recommended Posts

Posted

I think you could do drag a line over two object egdes then do parallel lines 5mm apart and auto trim.

 

Nothing at moment will have a think.

Screen Shot 08-30-17 at 05.18 PM.jpg

Posted (edited)

Try this pick inside two objects. You may want to take a little care picking the two points have ortho on etc.

 

; Create two paralell lines between two objects
; by crossing objects
; By Alan H Sep 2017 
(defun c:brid ( / pt1 pt2pt3 pt4 ss obj1 obj3 obj4)
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setq pt1 (getpoint "pick inside pt1"))
(while (/= (setq pt2 (getpoint pt1 "pick inside pt2")) nil)
(setq ss (ssget "f" (list pt1 pt2)))
(if (and (/= ss nil)(< 3 (sslength ss)))
(progn
(alert "do again more than two objects")(exit)
))
(setq obj1 (vlax-ename->vla-object (ssname ss 0)))
(setq obj2 (vlax-ename->vla-object (ssname ss 1)))
(command "line" pt1 pt2 "")
(setq obj3 (entlast))
(command "offset" 2.5 obj3 (polar pt1 (+ (/ pi 2.0)(angle pt1 pt2)) 5) "")
(setq obj4 (vlax-ename->vla-object (entlast)))
(setq pt3  (vlax-invoke obj1 'intersectWith obj4 acExtendThisEntity))
(setq pt4  (vlax-invoke obj2 'intersectWith obj4 acExtendThisEntity))
(vla-delete obj4)
(command "line" pt3 pt4 "")
(setq obj5 (entlast))
(command "offset" 2.5 obj3 (polar pt1 (+ (/ pi 2.0)(angle pt2 pt1)) 5) "")
(setq obj4 (vlax-ename->vla-object (entlast)))
(setq pt5  (vlax-invoke obj1 'intersectWith obj4 acExtendThisEntity))
(setq pt6  (vlax-invoke obj2 'intersectWith obj4 acExtendThisEntity))
(vla-delete obj4)
(command "line" pt5 pt6 "")
(setq obj6 (entlast))
(vla-delete (vlax-ename->vla-object obj3))
(command "trim" obj5 obj6 "" "f" pt1 pt2 "" "")
(setvar 'osmode oldsnap)
(setq pt1 pt2)
)
(princ)
)

Edited by BIGAL
Posted

Thank you BIGAL. Very helpful code. I'll try to modify as per my requirement. Check the attachment, need to connect all part with two line. Very tedious job.

1.jpg

2.jpg

3.jpg

Posted

Thats different to what I thought you wanted you should have mentioned laser cutting, ok you can use what I have done just add a 2 times BREAK to the code using the point I calculated and the correct obj id. It needs a "While" so can do lots of breaks, the randomness of the patterns makes it hard to add a join in some easy way but in saying that some one may have done it. The check for joins could be to do Pedit and join using a large window and say change colour.

 

Code changed to match what you have posted.

ScreenShot019.jpg

Posted

We do nesting manually in autocad and then import .dwg file in OmniWin (MesserSoft) software to generate CNC code.

The purpose of this exercise (part to part connection bridge) is to reduce numbers of CNC machine's piercing (continues cutting without leadin/leadout) to save cutting time.

 

@ BIGAL

 

I got your concern. Break can be done by adding (command "trim" "" "f" pt1 pt2 "" "") at the end of your lisp.

Refer FIG-A is our requirement, there should be only one IN and one OUT to each part.

FIG-B, My plan is to add lines manually as shown in red. So pt1 and pt2 can be identified for each part. I am working on it.

4.jpg

Posted

ggservers is the code I updated what you want as well sorry now two people requesting.

 

Dipesh I was thinking about it and yes doing a pline path is the way to go, it would require a big rewrite as you need to step through line co-ords and objects in a big loop. The code I posted would be a good starting point making a few defuns so the looping works. A simple fix for now is inside the while set pt2 to pt1 after the break etc and ask for new pt2 this will be like drawing the pline, put get pt1 before while.

 

I have changed the code again to work as like a pline pick its still manual but is the same as the way you suggested. Only hiccup is a two point line some shapes you may have to stop and restart.

Posted

Why not just purchase a good nesting software? The original thread was an entirely different request from what you want, so I will make this a separate thread AutoLISP, Visual LISP & DCL>Nesting bridge.

 

BIGAL, the OP request (ggservers) was from 5 years ago.

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