lastknownuser Posted October 14, 2021 Share Posted October 14, 2021 (edited) Need help with line relations. I attached a photo of example of final result I need. White lines are in layer1 and red in layer2. I need lisp to add text to each point between lines depending on the layer. Lines on layer1 get symbol M, on layer2 Z. That I managed to do, but I can't figure out how to add symbol M-Z on point where lines from layer1 and layer2 are connected. I tried with 3 ssget functions: points, lines from layer1 and lines from layer3. And then nested while that compares points and stard/end of lines, if the same then add symbol M or Z. Any idea about how to test the condition to get M-Z on point where white and red lines are connected? Edited October 15, 2021 by lastknownuser Quote Link to comment Share on other sites More sharing options...
mhupp Posted October 14, 2021 Share Posted October 14, 2021 Only seeing maybe it didn't get uploaded all the way. Quote Link to comment Share on other sites More sharing options...
lastknownuser Posted October 15, 2021 Author Share Posted October 15, 2021 I am sorry, the link I attached was set to privat, I have now attached the photo directly. Quote Link to comment Share on other sites More sharing options...
mhupp Posted October 15, 2021 Share Posted October 15, 2021 On 10/14/2021 at 9:31 AM, lastknownuser said: I tried with 3 ssget functions: points, lines from layer1 and lines from layer3. And then nested while that compares points and stard/end of lines, if the same then add symbol M or Z. Any idea about how to test the condition to get M-Z on point where white and red lines are connected? Your on the right path with this. except I would do it a bit different. just create all the M and Z text like normal but add them to SS3 as you go (ssadd SS3 (entlast)) Then once all the text are created compare them to each other if the have the same point set that to a variable then delete both text and use that point to create M-Z text. (defun C:Foo (/ SS3 tlst pt) (setq SS3 (ssget '((0 . "TEXT") '(410 . "Model")))) ;this is for my testing. (setq tlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS3)))) (setq tlst (vl-sort tlst '(lambda (a b) (if (equal (assoc 10 (entget a)) (assoc 10 (entget b)) 1e-6) (progn (setq pt (assoc 10 (entget a))) (entdel a) (entdel b) (vl-cmdf "_.Text" pt "" "" "M-Z") ) ) ) ) ) (princ) ) looks like your creating text with bottom left so thats 10 but if its something else you need to use 11. 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 16, 2021 Share Posted October 16, 2021 Another is intersectwith and get the int points. If white is considered "outside" then red is "inside" so dont label 1st and last of inside. Then update text at "ints". Quote Link to comment Share on other sites More sharing options...
lastknownuser Posted October 18, 2021 Author Share Posted October 18, 2021 @mhupp thanks for the idea! I managed to get it to work using that approach. @BIGAL is this what you ment? https://www.afralisp.net/archive/methods/lista/intersectwith_method.htm , I'm not familiar with it but will check it out. 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 18, 2021 Share Posted October 18, 2021 (edited) There are a couple of ways to use it (setq obj1(vlax-ename->vla-object (car (entsel "Pick obj")))) (setq obj2 (vlax-ename->vla-object (car (entsel "Pick obj")))) (setq intpt1 (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity)) Have a go and if you get stuck just post what you tried to use. Edited October 18, 2021 by BIGAL 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.