Jump to content

Fillet API


NirantarVidyarthee

Recommended Posts

It is recommended that you should avoid using (command) functions in AutoLISP.

 

But it seems that trim and fillet / chamfer are three tasks for which using the (command) function is the only viable alternative. (even com methods are not available for them).

 

I would like to here what you all think about it.

Link to comment
Share on other sites

Where do complex solids come here?

 

Its a simple question - Do you have no alternative to using (command "fillet" ...) .

Edited by NirantarVidyarthee
Link to comment
Share on other sites

Sample program using TRIM in a 2D context...

Load it and try in a darwing with a series of lines typing GRAPH in the command line:

(defun code-value (key ename)
 (cdr (assoc key (entget ename)))
) ;_ end of  defun
;;;Listing 10.9. Retrieving the value associated with a DXF group code.

(defun ent-text
      (txt-string style pt1 pt2 txt-height h-just v-just)
 (entmake (list '(0 . "TEXT")
                '(100 . "AcDbEntity")
                '(100 . "AcDbText")
                (cons 1 txt-string)
                (cons 7 style)
                (cons 10 pt1)
                (cons 11 pt2)
                (cons 40 txt-height)
                (cons 72 h-just)
                (cons 73 v-just)
          ) ;_ end of list
 ) ;_ end of entmake
) ;_ end of defun
;;;Listing 10.12. Fuction that creates a single line text entity.

(defun endpoint-circle
                      (radius / lines i line-ent pin pfi)
 (if (setq lines (ssget "X" '((0 . "LINE"))))
   (progn (setq i 0)
          (while (setq line-ent (ssname lines i))
            (setq pin (code-value 10 line-ent)
                  pfi (code-value 11 line-ent)
            ) ;_ end of setq
            (if (not (member pin drawn))
              (progn (vl-cmdf "._circle" pin radius)
                     (setq drawn (cons pin drawn))
              ) ;_ end of progn
            ) ;_ end of if
            (if (not (member pfi drawn))
              (progn (vl-cmdf "._circle" pfi radius)
                     (setq drawn (cons pfi drawn))
              ) ;_ end of progn
            ) ;_ end of if
            (setq i (1+ i))
          ) ;_ end of while
   ) ;_ end of progn
 ) ;_ end of if
) ;_ end of defun
;;;Listing 12.2. Function that draws circles at the line endpoints.

(defun trim-line-circle (/ circles lines obj endpoints)
 (if (and (setq circles (ssget "X" '((0 . "CIRCLE"))))
          (setq lines (ssget "X" '((0 . "LINE"))))
     ) ;_ end of and
   (progn (setq i 0)
          (while (setq obj (ssname lines i))
            (setq endpoints (cons (code-value 11 obj)
                                  (cons (code-value 10 obj)
                                        endpoints
                                  ) ;_ end of cons
                            ) ;_ end of cons
                  i         (1+ i)
            ) ;_ end of setq
          ) ;_ end of while
          (foreach pt endpoints
            (vl-cmdf "._trim" circles "" pt "")
          ) ;_ end of foreach
          (if (> (getvar "cmdactive") 0)
            (vl-cmdf)
          ) ;_ end of if
   ) ;_ end of progn
 ) ;_ end of if
) ;_ end of defun
;;;Listing 12.3. Function that demonstrates the use of TRIM from a VLISP function.

(defun number-nodes (pt-lst height / i pt)
 (setq pt-lst
        (vl-sort pt-lst
                 '(lambda (pt1 pt2) (> (cadr pt1) (cadr pt2)))
        ) ;_ end of vl-sort
 ) ;_ end of setq
 (setq i 0)
 (while (setq pt (nth i pt-lst))
   (ent-text (itoa (1+ i))
             (getvar "textstyle")
             pt
             pt
             height
             1
             2
   ) ;_ end of ent-text
   (setq i (1+ i))
 ) ;_ end of while
) ;_ end of defun
;;;Listing 12.4. Graph nodes numbering function.


(defun C:GRAPH (/ *error* radius drawn)
 (defun *error* (msg)
   (vl-cmdf "_UNDO" "_END")
   (vl-cmdf "_U")
   (setvar "osmode" oom)
   (prompt msg)
 ) 
 (setq oom (getvar "osmode"))
 (setvar "osmode" 0)
 (vl-cmdf "_UNDO" "_BEGIN")
 (setq radius (getreal "\nSpecify cirle radius: " ))
 (endpoint-circle radius)
 (trim-line-circle)
 (number-nodes drawn radius)
 (vl-cmdf "_UNDO" "_END")
 (setvar "osmode" oom)
 (princ)
)
;;;Listing 12.5. New command that automates the creation of network diagrams.

Figure 12.1.jpg

Command FILLET is essentially interactive. A solid with rounded edges can be programmed as a combination of solid primitives, i.e. a complex solid.

There is no FILLET method as you already know. So the way would be programming a complex solid.

As an interactive TRIM for solids, you can program it as the reference I included shows. Of course it is nothing but a way to use the existing methods, nothing else.

But it can save a few mouse clicks. After all that's what AutolISP is all about.

 

By the way, the object I use as avatar is a 3DSolid made using AutoLISP... somewhat complex, I believe.

Figure 12.2.jpg

Edited by togores
Link to comment
Share on other sites

Reinaldo N. Togores,

 

This thread has nothing to do with complex solids. Then why are you repeatedly posting irrelevant information and misleading the people and hijacking the thread?

 

I highly appreciate your expertise, your avatar, your Blog and your book. But please find more appropriate means to promote them and not other people's threads.

 

For me, both your posts are spam.

 

If you continue to do so, I will have to stop posting on this forum.

Link to comment
Share on other sites

NirantarVidarthee:

 

I use AUTOCADLT 2000 and it has a tool bar with icons for all three that all you have to do is click on them. Does 2010 not have the tool bars ??

Link to comment
Share on other sites

Since Mr. Togores doesn't understand what I have written and continues to spam, I am abandoning this thread.

 

I'll try to get reply from other forums.

 

Thank you.

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...