NirantarVidyarthee Posted March 2, 2013 Share Posted March 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
togores Posted March 2, 2013 Share Posted March 2, 2013 You could program creating complex solids using the ActiveX methods. You can see some examples in my blog, specifically about developing two new 3DSolid editing commands: TRIM and SPLIT in http://lispexpert.blogspot.com/p/chapter-18.html You can download these two commands for testing. Quote Link to comment Share on other sites More sharing options...
NirantarVidyarthee Posted March 2, 2013 Author Share Posted March 2, 2013 (edited) Where do complex solids come here? Its a simple question - Do you have no alternative to using (command "fillet" ...) . Edited March 2, 2013 by NirantarVidyarthee Quote Link to comment Share on other sites More sharing options...
togores Posted March 3, 2013 Share Posted March 3, 2013 (edited) 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. 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. Edited March 4, 2013 by togores Quote Link to comment Share on other sites More sharing options...
NirantarVidyarthee Posted March 3, 2013 Author Share Posted March 3, 2013 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. Quote Link to comment Share on other sites More sharing options...
welldriller Posted March 4, 2013 Share Posted March 4, 2013 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 ?? Quote Link to comment Share on other sites More sharing options...
NirantarVidyarthee Posted March 4, 2013 Author Share Posted March 4, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.