Jump to content

debug help : find pair based on conditions


samifox

Recommended Posts

Hi

 

i found a way to isolate them, that is by distance and angle.

 

im tring to find the columns in the stracture based on thier vertices relative location.

 

this code scan polylines's vertices and find their square pairs (please see the attached image to get what i mean)

 

this function get a vertex, a list of candidates, and the upper threshold of the condition. it ask the user to selects all polylines, than it extract their vertices and append them to one long list. than the vertex compared with the element # of the list for not being the same, and for the distance between them not more than d. only one can be pair of the vertex.

 

than a new list is contracted with a single pair and returned to the caller

 

(defun C:findPair (/ pl pts sspl tpts i ptlist)
   (if    (setq sspl (ssget '((0 . "LWPOLYLINE"))))
   (progn
       (setq i 0)
       (while (< i (sslength sspl))
       (setq pts (mapcar 'cdr
                 (vl-remove-if-not
                     '(lambda (e) (= (Car e) 10))
                     (entget (ssname sspl i))
                 )
             )
       )
       (setq i (1+ i))
       (setq tpts (cons pts tpts)) 

       )
   )
   )
   (setq tpts (apply 'append tpts))
   (setq ln (findPairs (nth 0 tpts) tpts 58))
;;;    (command "LINE" (nth 0 ln) (nth 1 ln) )
)


(defun findPairs(fxp lst d / i p tot col )

(setq i 0)
(while (< i (length lst))
   (setq col
        (vl-remove-if-not
        '(lambda (e)
             (and (not (equal fxp e)) (> d (distance (fxp e)))))lst))
   (setq i (1+ i))
   (setq tot (cons col tot))
)
   tot
)

its tell this :

 

; error: bad function: (488.547 225.746)

 

(and any idea why i cant follow brackpoint after lambda?)

 

Thanks

Shay

findpair.jpg

Link to comment
Share on other sites

i create another thread to help categorize it, meaning if someone will look for this information the title is more relevant to his search keywords

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...