assafius Posted September 7, 2012 Posted September 7, 2012 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 Quote
BIGAL Posted September 7, 2012 Posted September 7, 2012 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)) Quote
assafius Posted September 7, 2012 Author Posted September 7, 2012 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. Quote
Dadgad Posted September 7, 2012 Posted September 7, 2012 Welcome to the forum. Without using a lisp, you could do this with the FILTER command. Quote
MSasu Posted September 7, 2012 Posted September 7, 2012 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. Quote
assafius Posted September 7, 2012 Author Posted September 7, 2012 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 Quote
MSasu Posted September 7, 2012 Posted September 7, 2012 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. Quote
BIGAL Posted September 9, 2012 Posted September 9, 2012 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"))) Quote
Recommended Posts
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.