Jump to content

Recommended Posts

Posted

Hey fellows,

I'm sure that it has been asked before, but still:

 

I have a set of, say, 4 identical rectangles (or closed polylines for that matter)

plus a Polyline. I wish to :

 

1. Know which of the rectangles is intersected by the polyline.

2. Know the sequential order in which the four rectangles are being intersected.

 

By the way, is there any method to sort an array ? Let's assume

that I have an array of 2D points and that I want to sort it in a descending order with regard to its X coordinate.

 

Thanks a lot

Posted

Sorry no code examples but solutions would need to write code to more exactly match your request

 

Q1 "VL-Intersectwith" ....vlax-invoke obj2 'intersectWith obj1... will return true if the touch

 

Q2 theres another Vl command something like distancealong that will give the length along the pline Lee ?

 

Q3 theres a number of posts re sorting lists etc pretty sure theres a command VL-sort, else it can be done via lsp etc and swapping the list order "bubble sort"

 

Heres a roughy example line and arc crossing try it its not hard coded to entity type

(setq pickobj (entsel "\nPick arc :"))
(setq obj1 (vlax-ename->vla-object (car pickobj)))
(setq pt1 (cadr pickobj))  
(setvar "clayer" (cdr (assoc 8 (entget (car pickobj)))))
(setq pickobj1 (entsel "\nPick 1st line :"))
(setq obj2 (vlax-ename->vla-object (car pickobj1)))
(setq intpt1 (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity))

Posted

Thanks! your'e being helpful.

Another small thing:

Suppose I want to filter/find all the entities that share some common attribute (same layer for example) and that reside within a rectangular window in the modelspace, whose coordinates are known. What's the way to Lisp it please ?

 

thanks again.

Posted

Welcome to the forum. :)

Without using a lisp, you could do this with the FILTER command.

Posted

If you need to further process that selection set into a custom routine you have below an example - adjust it with your points and layer name.

(ssget "_W" '(5.84 25.04) '(36.68 5.24) '((8 . "MyLayerOfChoice")))

For more information please check the help for SSGET function; to build complex filters should investigate WCMATCH, too.

Posted

Not quite what I meant.

ssget employs the act of selection itself. I don't want to select anything. I assume to have 2 vertices that define a window and I wish to filter this and that entities within. How do I tell lisp to look which objects are inside some region (without using the mouse for selection...)

 

thanks a bunch

Posted

Did you tested the code above using the coordinates of your vertexes? The example I given you doesn't require user intervention.

 

You say that you don't want to select anything; I'm afraid that the only options to identify a bunch of items that match your conditions are:

  • create a selection set as instructed above,
  • parse drawing's database and retain only items that match the said conditions; this require a quite complicated code and does nothing more than first solution.

Posted

Like Msasu theres different ways to use ssget you can do simple stuf like W window, C crossing, X everything.

 

You can get variables "Extmin" "Extmax" this is the size as a window of your current layout. Then use code above.

 

(setq minn (getvar "extmin"))
(setq maxx (getvar "extmax")) 
(ssget "_W" minn maxx '((8 . "MyLayerOfChoice")))

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