Jump to content

Check if "INTERSECT" command returns another region


ethangale25

Recommended Posts

Hey everyone,

 

This could very well be simple, but I am not sure how to do it...

 

Here is a line in my code that uses the "INTERSECT" command on four different regions:

 

      (command "INTERSECT" currentregion massiveregion arearegion currentcourseinstanceregion "")
      (setq intersectregion (entlast))
      (setq intersectregion (vlax-ename->vla-object intersectregion)) ;convert to vlax
      (setq intersectarea (vla-get-area intersectregion))

 

In some cases, the intersect command returns the following:

 

Command: INTERSECT
Select objects: Specify opposite corner: 4 found
Select objects:
Null region created - deleted

 

when there aren't any overlapping areas of the four regions.

This in turn causes my lisp routine to fail at --> (setq intersectregion (entlast))

 

How do I "check" to see what the intersect command will return?

 

Thanks for the help

Link to comment
Share on other sites

@ethangale25

1) For the first part, without the context of your full code and a sample drawing, it is kinda hard diagnose what is happening.

2) for the 2nd part: I recommend:

   a) before doing the intersect, put the last entity into a variable: (setq le (entlast)),

   b) then after the intersect, put the last entity into a 2nd variable: (setq le2 (entlast)).

   c) Then compare the handles of the two entities to see if they are the same: (= (cdr (assoc 5 (entget le))) (cdr (assoc 5 (entget le2)))).

If they are the same, then the intersect did not produce anything, if they are different, then the intersect was probably successful.

Edited by pkenewell
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...