Search the Community
Showing results for tags 'nearest polyline'.
-
How can I find the nearest line which is parallel with the target entity. As in the image, I want to find the green line in both case, notice the red line has a smaller distance to my target "abcedfg", but in the second case, the parallel part of the polyline has a longer distance than the green line. In fact, I need to know the exact amount of the distance to the parallel line to get my lisp start working. All white ones is for distraction test... It's been a while since last time I wrote anything in English, please pardon my terrible description if you don't mind.
-
Find nearest polyline, create new vertex and extract Object Data
jes_g posted a topic in AutoLISP, Visual LISP & DCL
Hi all, I'm trying write a LISP routine which will accomplish the following: 1. Select the block reference on the drawing 2. Find the closest polyline and closest point on that polyline from this block reference 3. Create vertex on that point and save the coordinates of this point into a variable for further use 4. Extract Object Data such as SerialNo (please refer to the screenshot attached) from that block reference 5. Loop for each block reference 6. Export the point's coordinates saved earlier and its corresponding SerialNo into txt or csv which will look like: X_coord, Y_coord, SerialNo E.g. 85.4535, 18.7903, 09I4E5Q2104022719 or 85.4535, 18.7903, 09I4E5Q2104022311, 09I4E5Q2104022719 (if it has more than one block reference) The output file is interpreted as the electric line having the load on that particular point. Here's what I have found/borrowed so far which can be of help: For creating vertex program provided by DEVITG at this thread ;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA ;;; Copyleft 1995-2018 by Gabriel Calos De Vit ;; DEVITG@GMAIL.COM ; Hecho por Gabo CALOS DE VIT de CORDOBA ARGENTINA ;;; Copyleft 1995-2018 por Gabriel Calos De Vit ;; DEVITG@GMAIL.COM ; no error check. ;; no nothing (vl-load-com) (DEFUN C:EXAMPLE_ADDVERTEX ( / ACADOBJ BLK-REF-XYZ BLK-REFERENCE DOC LSTPOINT MODELSPACE NEWVERTEX PARAM-AT-CLOSEST-POINT PLINE PLINE-OBJ POINT-AT-PARAM VERTEX-POINT ) (SETQ ACADOBJ (VLAX-GET-ACAD-OBJECT)) (SETQ DOC (VLA-GET-ACTIVEDOCUMENT ACADOBJ)) (SETQ MODELSPACE (VLA-GET-MODELSPACE DOC)) (SETQ PLINE (ENTSEL "\nSelect Polyline: ")) (SETQ PLINE-OBJ (VLAX-ENAME->VLA-OBJECT (CAR PLINE))) (SETQ BLK-REFERENCE (CAR (ENTSEL "\Select the block-reference"))) (SETQ BLK-REF-XYZ (CDR (ASSOC 10 (ENTGET BLK-REFERENCE)))) ;;; (VL-CMDF "POINT" BLK-REF-XYZ "") (SETQ LSTPOINT (VLAX-CURVE-GETCLOSESTPOINTTO PLINE-OBJ BLK-REF-XYZ)) (SETQ PARAM-AT-CLOSEST-POINT (VLAX-CURVE-GETPARAMATPOINT PLINE-OBJ LSTPOINT)) (SETQ POINT-AT-PARAM (VLAX-CURVE-GETPOINTATPARAM PLINE-OBJ PARAM-AT-CLOSEST-POINT)) (SETQ VERTEX-POINT (LIST (CAR POINT-AT-PARAM) (CADR POINT-AT-PARAM))) ;;; (VL-CMDF "POINT" VERTEX-POINT "") (SETQ NEWVERTEX (VLAX-MAKE-SAFEARRAY VLAX-VBDOUBLE '(0 . 1))) (VLAX-SAFEARRAY-FILL NEWVERTEX VERTEX-POINT) (VLA-ADDVERTEX PLINE-OBJ (1+ (FIX PARAM-AT-CLOSEST-POINT)) NEWVERTEX) (VLA-UPDATE PLINE-OBJ) ) It works good but now it needs to be modified to work in a loop For extracting Object Data the answer provided by BlackBox at this thread might be helpful The Sample Drawing is attached I would appreciate your help Thank you Regards, Jes G Sample_Drawing.dwg- 7 replies
-
- nearest polyline
- extract od
-
(and 3 more)
Tagged with: