Lee Mac Posted July 23, 2009 Posted July 23, 2009 Just a quick idea came to me, as I remember having to break a lot of circles to show hidden lines etc on drawings, so this should make life a lot easier for you guys (defun c:cBrk (/ *error* vl ov p1 ent p2 aDef flag ent) (vl-load-com) (defun *error* (msg) (if ov (mapcar 'setvar vl ov)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " msg " >>"))) (princ)) (setq vl '("CMDECHO" "OSMODE") ov (mapcar 'getvar vl)) (or (eq 512 (logand 512 (getvar 'OSMODE))) (setvar 'OSMODE (+ (getvar 'OSMODE) 512))) (while (progn (setq p1 (getpoint "\nSelect Point on Circle: ")) (cond ((vl-consp p1) (if (and (setq ent (car (nentselp p1))) (not (eq "CIRCLE" (cdr (assoc 0 (entget ent)))))) (princ "\n** Point does not lie on a Circle **"))) (t (princ "\n** No Point Selected **"))))) (while (progn (setq p2 (getpoint "\nSelect Second Point to Break: ")) (cond ((vl-consp p2) (cond ((eq p1 p2) (princ "\n** Points must be distinct **")) (t (setq p2 (vlax-curve-getClosestPointto ent p2)) nil))) (t (princ "\n** No Point Selected **"))))) (setq cen (cdr (assoc 10 (entget ent)))) (repeat 2 (setq aDef (list (cons 100 "AcDcEntity") (cons 0 "ARC"))) (foreach dxf '(8 10 40 210) (setq aDef (cons (assoc dxf (entget ent)) aDef))) (setq aDef (append (reverse aDef) (list (cons 50 (if flag (angle cen p1) (angle cen p2))) (cons 51 (if flag (angle cen p2) (angle cen p1)))))) (entmake aDef) (setq flag t)) (entdel ent) (mapcar 'setvar vl ov) (princ)) Quote
Lee Mac Posted July 23, 2009 Author Posted July 23, 2009 I think someone is bored at home! Only in the evenings with nothing on TV Quote
ReMark Posted July 23, 2009 Posted July 23, 2009 Lee: Is your master business plan to give away all your code for free? What are you going to do for a job? Quote
CADMASTER1128 Posted July 23, 2009 Posted July 23, 2009 Lee: Is your master business plan to give away all your code for free? What are you going to do for a job? He makes a point, CADTutor members should get it 50% off, and then charge super cheap prices. And you pick testers (that you trust not to give it away free) to test the LISP. Quote
Lee Mac Posted July 23, 2009 Author Posted July 23, 2009 Lee: Is your master business plan to give away all your code for free? What are you going to do for a job? I know Mark :wink: I figure that even if I start charging for code, others will provide if free anyway. Quote
ReMark Posted July 23, 2009 Posted July 23, 2009 Then you are determined to give away more code than anyone else right? Dang! You are a mastermind. You need to meet with Donald Trump. Quote
Lee Mac Posted July 23, 2009 Author Posted July 23, 2009 Then you are determined to give away more code than anyone else right? Dang! You are a mastermind. You need to meet with Donald Trump. If that isn't sarcasm, then I don't know LISP ... :wink: Quote
ReMark Posted July 23, 2009 Posted July 23, 2009 I hold you in the highest of regard Lee sarcasm not withstanding. Quote
Lee Mac Posted July 23, 2009 Author Posted July 23, 2009 I hold you in the highest of regard Lee sarcasm not withstanding. Thanks mate, you're not too bad yourself Quote
Lee Mac Posted July 23, 2009 Author Posted July 23, 2009 Or, with a more relaible point selection method: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:cBrk [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] *error* vl ov p1 ent p2 aDef flag ent Objlst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] *error* [b][color=RED]([/color][/b]msg[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] ov [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]setvar[/color][/b] vl ov[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]wcmatch[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcase[/color][/b] msg[b][color=RED])[/color][/b] [b][color=#ff00ff]"*BREAK,*CANCEL*,*EXIT*"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#ff00ff]"\n<< Error: "[/color][/b] msg [b][color=#ff00ff]" >>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] vl [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#ff00ff]"CMDECHO"[/color][/b] [b][color=#ff00ff]"OSMODE"[/color][/b][b][color=RED])[/color][/b] ov [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]getvar[/color][/b] vl[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#009900]512[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]logand[/color][/b] [b][color=#009900]512[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=DARKRED]'[/color][/b]OSMODE[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setvar[/color][/b] [b][color=DARKRED]'[/color][/b]OSMODE [b][color=RED]([/color][/b][b][color=BLUE]+[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=DARKRED]'[/color][/b]OSMODE[b][color=RED])[/color][/b] [b][color=#009900]512[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=#ff00ff]"_X"[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] . [b][color=#ff00ff]"CIRCLE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Objlst [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] p1 [b][color=RED]([/color][/b][b][color=BLUE]getpoint[/color][/b] [b][color=#ff00ff]"\nSelect Point on Circle: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]vl-consp[/color][/b] p1[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ent [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]nentselp[/color][/b] p1[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"CIRCLE"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]0[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ent [b][color=BLUE]nil[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] ent[b][color=RED])[/color][/b] Objlst[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getParamatPoint[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] Objlst[b][color=RED])[/color][/b] p1[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ent [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] Objlst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Objlst [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] Objlst[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Point does not lie on a Circle **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]t[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** No Point Selected **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] p2 [b][color=RED]([/color][/b][b][color=BLUE]getpoint[/color][/b] [b][color=#ff00ff]"\nSelect Second Point to Break: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]vl-consp[/color][/b] p2[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] p1 p2[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Points must be distinct **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]t[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] p2 [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getClosestPointto[/color][/b] ent p2[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=BLUE]nil[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]t[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** No Point Selected **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] cen [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]10[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]repeat[/color][/b] [b][color=#009900]2[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] aDef [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]100[/color][/b] [b][color=#ff00ff]"AcDcEntity"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#ff00ff]"ARC"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] dxf [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]8[/color][/b] [b][color=#009900]10[/color][/b] [b][color=#009900]40[/color][/b] [b][color=#009900]210[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] aDef [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] dxf [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] aDef[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] aDef [b][color=RED]([/color][/b][b][color=BLUE]append[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]reverse[/color][/b] aDef[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]50[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] flag [b][color=RED]([/color][/b][b][color=BLUE]angle[/color][/b] cen p1[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]angle[/color][/b] cen p2[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]51[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] flag [b][color=RED]([/color][/b][b][color=BLUE]angle[/color][/b] cen p2[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]angle[/color][/b] cen p1[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entmake[/color][/b] aDef[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] flag [b][color=BLUE]t[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entdel[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** No Circles Found in Drawing **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]setvar[/color][/b] vl ov[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote
CADMASTER1128 Posted July 24, 2009 Posted July 24, 2009 I have to say that this isn't a bad little app. Very nice work, again. Quote
flowerrobot Posted July 24, 2009 Posted July 24, 2009 I figure that even if I start charging for code, others will provide if free anyway. May i suggest you aleast put headers on your programs With your programs, Are we able to distrubute them to others. Because there is a few good ones, which some of my colleges wouldnt mind using im sure. P.s update your pipe drawer for all pipe sizes Quote
Lee Mac Posted July 24, 2009 Author Posted July 24, 2009 May i suggest you aleast put headers on your programs With your programs, Are we able to distrubute them to others. Because there is a few good ones, which some of my colleges wouldnt mind using im sure. P.s update your pipe drawer for all pipe sizes Thanks Flower, I do put headers on the main programs that take a bit more insight to create, but not normally on these small ones As for the distribution, with the header in tact, I still own interlectual rights to the code - as implied by the copyright. But I have provided it for free, so you may let your colleagues use it also - as long as the header stays in tact. But I am rapidly changing my view on this approach. I don't think I will offer programs freely in the future, but rather for a small fee. Lee Quote
Commandobill Posted July 24, 2009 Posted July 24, 2009 but rather for a small fee. Lee ....................................................... Quote
ReMark Posted July 24, 2009 Posted July 24, 2009 Lee: Have you ever considered contacting a company like dotsoft and seeing if they might be interested in some of your code? For a price that is. Quote
Lee Mac Posted July 24, 2009 Author Posted July 24, 2009 Lee: Have you ever considered contacting a company like dotsoft and seeing if they might be interested in some of your code? For a price that is. I haven't contacted any company regarding my code, but I think its definitely worth a shot - they can only say "no"... Quote
mdbdesign Posted July 24, 2009 Posted July 24, 2009 One thing before you start charging for programs. Can you add options to to change user selected circle part to hidden layer? Quote
SEANT Posted July 24, 2009 Posted July 24, 2009 I’ve also wondered what the most efficient process would be to offer routines for sale. Certainly the industry specific add-on packages are lucrative enough to justify the necessary advertising, web sites, merchant accounts, etc. For more modest sized offerings, however, that’s a lot of overhead to recoup before a break even point. It would be nice if there were some clearinghouse style of setup, employing PayPal perhaps, that would allow the sale of routines at a modest price without the whole process becoming just another expensive hobby for the programmer. Quote
Lee Mac Posted July 24, 2009 Author Posted July 24, 2009 One thing before you start charging for programs.Can you add options to to change user selected circle part to hidden layer? haha, I wondered when I'd see this request I’ve also wondered what the most efficient process would be to offer routines for sale. Certainly the industry specific add-on packages are lucrative enough to justify the necessary advertising, web sites, merchant accounts, etc. For more modest sized offerings, however, that’s a lot of overhead to recoup before a break even point. It would be nice if there were some clearinghouse style of setup, employing PayPal perhaps, that would allow the sale of routines at a modest price without the whole process becoming just another expensive hobby for the programmer. You have hit the nail on the head Sean. At the moment I am charging a small fee to make LISPs on request and am using Paypal to sort out the business side of things. But, of course, this is only through emails - not a professional website etc. I would like to make my own website, but, to get it right and how I'd want it would take a lot of time, especially since I have no experience with website creation... I'm not really sure how much I would sell the routines for if I did decide to put them all on a site - I suppose this would depend on the functionality of the routine. I've seen routines out there selling for around £50, but then others (bigger programs - but still LISP), selling for around £750. I think if I am going to proceed with this, I will have to make my own website, or get a friend to make me one - otherwise I am just lost in the forums... Thanks, Lee Quote
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.