anupmadhu Posted March 21, 2015 Share Posted March 21, 2015 It can be used for counting no of fittings in irrigation network to calculate no of reducers needed. ie 1" will be separate layer & 1.5" will be in different layer, by counting the inserted blocks gives us the no 1.5*1" reducer Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 21, 2015 Share Posted March 21, 2015 You may be able to modify this code to suit your needs. Quote Link to comment Share on other sites More sharing options...
anupmadhu Posted March 22, 2015 Author Share Posted March 22, 2015 Sir, What i wan't is layer selection instead of an object selection, because in an irrigation drawing there will be hundreds of intersection So just by selecting a layer 1" pipes and layer 1.5" will give me the no reducers needed. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 23, 2015 Share Posted March 23, 2015 You need a double loop ie take all 1" lines and make a selection set then take all 1.5" lines and make a selection set, you then loop through the 1" 1 at a time comparing the 2nd selection set for possible intersections and if so do something. Its achievable but I dont have code. Look at what Lee posted maybe as a start hint, INTERSECTWITH obj1 obj2 true or false. Quote Link to comment Share on other sites More sharing options...
anupmadhu Posted March 23, 2015 Author Share Posted March 23, 2015 Hi lee Can the layer selection be added Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 24, 2015 Share Posted March 24, 2015 This is close but I need help its extending plines so extra points instead of only 1 intersect. (defun sprinklers ( / ss1 ss2 x y len1 len2) (vl-load-com) (setq obj (entsel "\nPick 1st layer")) (setq lay1 (vla-get-layer (vlax-ename->vla-object (car obj)))) (setq obj (entsel "\npick 2nd layer")) (setq lay2 (vla-get-layer (vlax-ename->vla-object (car obj)))) (setq ss1 (ssget "X" (list (cons 8 lay1)))) (setq ss2 (ssget "X" (list (cons 8 lay2)))) (setq len1 (sslength ss1)) (setq len2 (sslength ss2)) (setq x 0 total 0) (repeat len1 (setq y 0) (setq obj1 (vlax-ename->vla-object(ssname ss1 x))) (repeat len2 (setq obj2 (vlax-ename->vla-object (ssname ss2 y))) (setq pt (vla-intersectwith obj2 obj1 0)) (if (/= pt nil)(setq total (+ total 1))(Princ "Miss")) (setq y (+ y 1)) ) ; len2 (setq x (+ x 1)) ) ; len1 (princ Total) ) ; defun (sprinklers) Quote Link to comment Share on other sites More sharing options...
neophoible Posted April 1, 2015 Share Posted April 1, 2015 Another work around for this sort of thing is to copy just the layers you need into a separate drawing (along with the block), then run the program. You can then transfer the results back to the original drawing. This way, no more programming is needed. Quote Link to comment Share on other sites More sharing options...
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.