|
发表于 2022-7-5 19:05:56
|
显示全部楼层
So this is where my code is at now. You can see that I just use the vlax-curve-getClosestPointto for pt2. However, this doesn't actually always give the perpendicular point because it takes into the account the distance including the z value.
[code](defun c:maxheight (/ *error* maxdist ss1 ss2 pt3 pt4) (defun *error* (msg) (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\nError: " msg)) ) (princ) ) (if (and (setq ss1 (LM:ssget "\nSelect 1st 3D Polyline/Feature Line: " '("_+.:E:S" ((0 . "POLYLINE,AECC_FEATURE_LINE"))) ) ) (setq ss2 (LM:ssget "\nSelect 2nd 3D Polyline/Feature Line: " '("_+.:E:S" ((0 . "POLYLINE,AECC_FEATURE_LINE"))) ) ) ) (progn (maxheight:mainprogram) (maxheight:ans) ) ) (princ));;;This is the answer portion of the code(defun maxheight:ans () (initget "Yes No") (setq *maxheightans* (cond ( (getkword (strcat "\nDraw a line at max height location [Yes/No] : " ) ) ) (*maxheightans*) ) ) (if (= *maxheightans* "Yes") (progn (command "._line" pt3 pt4 "") (command "._zoom" "_W" pt3 pt4) ) ) (alert(strcat "\nThe maximum vertical distance between the entities is: " (rtos maxdist 2 2)) ) (princ(strcat "\nThe maximum vertical distance between the entities is: " (rtos maxdist 2 2)) ));;;Main code portion(defun maxheight:mainprogram (/ ent1 ent2 len delta pt1 pt2 z1 z2 maxdist1) (setq ent1 (vlax-ename->vla-object (ssname ss1 0))ent2 (vlax-ename->vla-object (ssname ss2 0))delta 0.0maxdist 0.0 ) (if ( |
|