Author Topic: Intersection of line and 3Dsolid  (Read 1720 times)

0 Members and 1 Guest are viewing this topic.

mac0312

  • Mosquito
  • Posts: 13
Intersection of line and 3Dsolid
« on: August 30, 2017, 06:29:59 AM »
Hi,friends!
I use Marko's program and find some intersections are not marked.https://www.theswamp.org/index.php?topic=49307.msg544044#msg544044
See attachment

ribarm

  • Gator
  • Posts: 3251
  • Marko Ribar, architect
Re: Intersection of line and 3Dsolid
« Reply #1 on: August 30, 2017, 10:04:23 AM »
I agree with the fact that some of the lines are touching 3d solid and not going through it... In that situations IMPRINT can't find points of intersections as they don't exist... Either way, I've updated 2 last posted codes from that link, and you should use last one as it's designed for finding multiple curves intersections with 3d solid like in your posted DWG... Not to attach anything (DWG ab 4MB), you should get with my last routine 218 points of intersections... So recheck it and inform us if something's wrong...

Regards, M.R. :-)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ahsattarian

  • Newt
  • Posts: 112
Re: Intersection of line and 3Dsolid
« Reply #2 on: August 16, 2021, 04:00:51 PM »
See this   :

ahsattarian

  • Newt
  • Posts: 112
Re: Intersection of line and 3Dsolid
« Reply #3 on: August 17, 2021, 04:25:48 AM »
Try This  :



Code - Auto/Visual Lisp: [Select]
  1. (defun c:a ()
  2.   (defun sub1 () (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")))
  3.   (setq ss1 (ssget '((0 . "3dsolid"))))
  4.   (setq ss2 (ssget '((0 . "*polyline,line,spline,ellipse,arc,circle,ray,xline,helix"))))
  5.   (setvar "cmdecho" 0)
  6.   (setq li nil)
  7.   (setq n1 (sslength ss1))
  8.   (setq k1 -1)
  9.   (repeat n1
  10.     (setq k1 (1+ k1))
  11.     (setq s1 (ssname ss1 k1))
  12.     (setq n2 (sslength ss2))
  13.     (setq k2 -1)
  14.     (repeat n2
  15.       (setq k2 (1+ k2))
  16.       (setq s2 (ssname ss2 k2))
  17.       (command "undo" "mark")
  18.       (setq en2 (entget s2))
  19.       (setq la (cdr (assoc 8 en2)))
  20.       (cond ((= (logand 4 (cdr (assoc 70 (tblsearch "layer" la)))) 4) (command "layer" "unlock" la "")))
  21.       (command "imprint" s1 s2)
  22.       (sub1)
  23.       (setq ss3 (ssadd))
  24.       (ssadd s1 ss3)
  25.       (setq n3 (sslength ss3))
  26.       (while (> n3 0)
  27.         (setq ssince (entlast))
  28.         (setq n3 (sslength ss3))
  29.         (setq k3 -1)
  30.         (repeat n3
  31.           (setq k3 (1+ k3))
  32.           (setq s3 (ssname ss3 k3))
  33.           (setq en3 (entget s3))
  34.           (setq typ3 (strcase (cdr (assoc 0 en3)) t))
  35.           (cond
  36.             ((member typ3 '("region" "3dsolid")) (command "explode" s3) (sub1))
  37.             ((= typ3 "point") (setq po (cdr (assoc 10 en3))) (setq li (append li (list po))))
  38.           )
  39.         )
  40.         (if ssince
  41.           (setq sj (entnext ssince))
  42.           (setq sj (entnext))
  43.         )
  44.         (setq ss3 (ssadd))
  45.         (while sj (ssadd sj ss3) (setq sj (entnext sj)))
  46.         (setq n3 (sslength ss3))
  47.       )
  48.       (command "undo" "back")
  49.     )
  50.   )
  51.   (setq n4 (length li))
  52.   (princ (strcat "\n Number of Points  :  " (itoa n4) "  \n"))
  53.   (cond ((> n4 0) (foreach po li (command "point" po) (ssadd (entlast) reg))))
  54.   (princ)
  55. )