Author Topic: Start and Endpoint of arc using DXF codes  (Read 1625 times)

0 Members and 1 Guest are viewing this topic.

cgeorg13

  • Guest
Start and Endpoint of arc using DXF codes
« on: May 05, 2016, 09:22:38 AM »
Im trying to build somewhat of a join function that will entmod lines/arcs. I'm searching a 1x1 area around each endpoint for like objects' endpoints (sort of the same idea as a fuzz distance, just not nearly as intricate).

I plan on using entmod to relocate the start/endpoint of the lines that find matches within the search area and allowing the "pedit" command to do the rest at the end of the routine.

Problem is, arcs don't have a DXF 10 as a startpoint and 11 as an endpoint, DXF 10 is the center of the arc.

So, I'm wondering if there is a way to use DXF codes from an arc in a SSGET function that will select the arc if its startpoint/endpoint is within the fuzz distance

This is what I have for the SSGET section but realized the arc filter wasnt correct:
Code - Auto/Visual Lisp: [Select]
  1. (defun getObjectsToModify(pt lay/ x y pp pm mp mm)
  2.   (setq x (car pt)
  3.         y (cadr pt)
  4.         pp (list (+ x 1.5) (+ y 1.5) 0.0)
  5.         pm (list (+ x 1.5) (- y 1.5) 0.0)
  6.         mp (list (- x 1.5) (+ y 1.5) 0.0)
  7.         mm (list (- x 1.5) (- y 1.5) 0.0)
  8.         )
  9.   (setq entlst (ssget "_X"
  10.                  (list
  11.                    (cons -4 "<OR")
  12.                 ;;;         (cons -4 "<AND")(cons 0 "ARC") (cons 8 lay)
  13.                 ;;;             (cons -4 "<,<,*") (cons 10 pp)
  14.                 ;;;             (cons -4 "<,>,*") (cons 10 pm)
  15.                 ;;;             (cons -4 ">,<,*") (cons 10 mp)
  16.                 ;;;             (cons -4 ">,>,*") (cons 10 mm)
  17.                 ;;;             (cons -4 "AND>")
  18.                             (cons -4 "<AND")(cons 0 "LINE") (cons 8 lay)
  19.                                 (cons -4 "<,<,*") (cons 10 pp)
  20.                                 (cons -4 "<,>,*") (cons 10 pm)
  21.                                 (cons -4 ">,<,*") (cons 10 mp)
  22.                                 (cons -4 ">,>,*") (cons 10 mm)
  23.                                 (cons -4 "AND>")
  24.                     (cons -4 "OR>")
  25.                    )
  26.                  )
  27.         )
  28.   )
  29.  
« Last Edit: May 05, 2016, 09:34:38 AM by cgeorg13 »

ChrisCarlson

  • Guest
Re: Start and Endpoint of arc using DXF codes
« Reply #1 on: May 05, 2016, 09:40:16 AM »
Can you do vlisp?

Code - Auto/Visual Lisp: [Select]

Code - Auto/Visual Lisp: [Select]

PKENEWELL

  • Bull Frog
  • Posts: 320
Re: Start and Endpoint of arc using DXF codes
« Reply #2 on: May 05, 2016, 09:55:48 AM »
Problem is, arcs don't have a DXF 10 as a startpoint and 11 as an endpoint, DXF 10 is the center of the arc.

I don't think its possible to do this within the (ssget) filters. You will have to get all the arcs in the selection, them filter out the ones that meet the criteria by calculating the start and end points from the DXF data.

Example code (untested):
Code - Auto/Visual Lisp: [Select]
  1. (repeat (sslength entlst)
  2.    (setq el (entget (setq en (ssname (setq cnt (if cnt (1+ cnt) 0)) entlst))))
  3.    (if (= (cdr (assoc 0 el)) "ARC")
  4.       (setq cp (cdr (assoc 10 el))
  5.                p1 (polar cp (cdr (assoc 50 el)) (cdr (assoc 40 el)))
  6.                p2 (polar cp (cdr (assoc 51 el)) (cdr (assoc 40 el)))
  7.                alst (cons (list en p1 p2) alst)
  8.       )
  9.    )
  10. )

Edit: Sorry made some syntax corrections to above - was typing it in a hurry.
« Last Edit: May 05, 2016, 10:02:10 AM by PKENEWELL »
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

cgeorg13

  • Guest
Re: Start and Endpoint of arc using DXF codes
« Reply #3 on: May 05, 2016, 10:13:16 AM »
You will have to get all the arcs in the selection, them filter out the ones that meet the criteria by calculating the start and end points from the DXF data.

Thats what i was afraid of, these drawings can have thousands of arcs in them and building lists like that and iterating through them would take up way too much time.

I'm thinking about doing a crossing poly SSGET with a temp zoom and filter only arcs for one selection set and then testing for lines the previously stated way and then returning a combined SS of the arcs and lines.

Code - Auto/Visual Lisp: [Select]

At that point ill be able to test the arcs that were returned in the SS using these commands.

Still trying to work this out though, any tips in terms of speed/accuracy in this is appreciated due to my lack of knowledge in the speed of certain commands and how itll affect the runtime on this large of a drawing