Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Required parallel line gap by given points

avinash00002002
Collaborator

Required parallel line gap by given points

avinash00002002
Collaborator
Collaborator

Hi!

I have a require that need inside hidden line gap to determine thickness of member. I have a point cp1, cp2, cp3 and cp4.

all other line may be hidden or continuous line for more clarity I have attached drawing.

 

any logic/function?

Thanks,

Avinash Patil

0 Likes
Reply
690 Views
11 Replies
Replies (11)

Sea-Haven
Mentor
Mentor

If you select the white line then blue dashed you can do the following. Via a lisp.

Get start and end of white line

Get intersectiont point of blue and white lines.

Compare the int to start and end to get closest ie swap if required

Do dim intpt, endpt, pick offset all done

 

So if your drawing the rectang the should know which points represent the white line.

0 Likes

avinash00002002
Collaborator
Collaborator

I have points cp1, cp2, cp3 and cp4. I don't want to select anything

0 Likes

avinash00002002
Collaborator
Collaborator

Or I can do selection any of line which has cp1 to cp4 points

0 Likes

Sea-Haven
Mentor
Mentor
0 Likes

Kent1Cooper
Consultant
Consultant

Are the four known points always in the same order around the rectangle, i.e. 1-2-4-3 going around, not in numerical order?  If so, I would think [untested] this:

 

(ssget "_CP" (list CP1 CP2 CP4 CP3) '((0 . "LINE") (8 . "H")))

 

would find it.  In your lower cases 4-5-6, that would be all -- only one Line on that Layer.  In the upper ones, with the rectangle's Lines on the same Layer as the one you want, you would need to step through the selection set and check whether either end of each Line is at any of the known points, and keep only the one that doesn't have either endpoint on one of them.

Kent Cooper, AIA
0 Likes

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

.... I would think [untested] this:

 

(ssget "_CP" (list CP1 CP2 CP4 CP3) '((0 . "LINE") (8 . "H")))

 

would find it.  ....  you would need to step through the selection set and check ....


I tried that, this way:

 

(defun matches ()
  (setq pt (vlax-curve-getStartPoint line))
  (member T
    (mapcar
      '(lambda (x) (equal pt x 1e-4))
      (list CP1 CP2 CP3 CP4)
    ); mapcar
  ); member
); defun

(defun C:DOIT (/ ss n)
  (if (setq ss (ssget "_CP" (list CP1 CP2 CP4 CP3) '((0 . "LINE") (8 . "H"))))
    (progn
      (if (> (sslength ss) 1)
        (repeat (setq n (sslength ss))
          (setq line (ssname ss (setq n (1- n))))
          (if (matches) (ssdel line ss))
        ); repeat
      ); if
      (setq YourLine (ssname ss 0))
    ); progn
  ); if
  (princ)
); defun

 

For some reason I haven't figured out, it didn't work right in your CASE-1 example [it didn't "see" the Line you want in the selection], but did in all the others, including the illustration of where the known points are.

Kent Cooper, AIA
0 Likes

avinash00002002
Collaborator
Collaborator

Thanks for your reply,

 

if the hidden lines are more in parallel or perpendicular position near by I need the line, then It compare the length of all lines with line length (distance cp1 cp2). 

the result required is 

1. if the line is matches with (distance cp1 cp2)

2. if the line is more than (distance cp1 cp2)

3. if the line is slightly small than (distance cp1 cp2)

 

for condition I have attached another drawing.

Avinash

0 Likes

Kent1Cooper
Consultant
Consultant

@avinash00002002 wrote:

.... 

the result required is 

1. if the line is matches with (distance cp1 cp2)

2. if the line is more than (distance cp1 cp2)

3. if the line is slightly small than (distance cp1 cp2)

....


Well, that's a rather different set of circumstances, if there can be many more Lines than the one you want, on the same Layer within the area of the set of known points.  But it seems to me that one length test will do: your option 3 or longer [and without its endpoints on the known points].  Options 1 & 2 would be covered by that.  Do you have any percentage in mind for what qualifies as "slightly" shorter?  At least 75% as long?  90%?

Kent Cooper, AIA
0 Likes

avinash00002002
Collaborator
Collaborator

90% slightly smaller reqd.

0 Likes

Sea-Haven
Mentor
Mentor

My question is how do you draw the 4 point lines,  do you select the line 1st for angle etc then work out the 4 points ? 

 

Had a thought about compare mid pt to anything found in a expanding ssget. Did pedit multiple 1st and a join. Makes a bit easier can compare line to lwpolyline. Thinking do all cases in one go.

0 Likes

avinash00002002
Collaborator
Collaborator

These are only LINE object and it created by line command. it is 4 points already there by selecting 4 lines.

0 Likes