Lee Mac Posted December 19, 2008 Posted December 19, 2008 No probs, Glad we finally got the problem fully resolved. Quote
AustinTECH Posted January 22, 2009 Posted January 22, 2009 I was wondering if anyone know how to combine these to lisp comands. One allows you to offset to both sides of a line and the other changes the line layer when you offset. Anyone have any ideas? What is a good way to learn how to creat lisp commands. Are there any books out there that anyone can suggest to read. Thanks:) (defun c:doff(/ oldDis plSet plLst delFlg) (vl-load-com) (if(not doffdis)(setq doffdis 10.0)) (setq oldDis doffdis doffdis(getdist (strcat "\nSpecify offset distance (rtos doffdis (getvar "LUNITS") (getvar "LUPREC")) ">: ")) ); end setq (if (not doffdis) (setq doffdis oldDis) ); end setq (if (setq plSet (ssget '((0 . "LWPOLYLINE,LINE,ARC,CIRCLE,ELLIPSE,SPLINE")))) (progn (setq plLst (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex plSet))))) (foreach pl plLst (vla-Offset pl doffdis) (vla-Offset pl(- doffdis)) ); end foreach (initget "Yes No") (setq delFlg(getkword "\nDelete source objects [Yes/No]? : ")) (if(null delFlg)(setq delFlg "Yes")) (if(= "Yes" delFlg) (mapcar 'vla-Delete plLst) ); end if ); end progn ); end if (princ) ); end of c:outline (princ "\n*** Type DOFF for doubleside offset *** ") _________________________________________________ (defun c:membrane (/ ent pt l1 l2) (setq oldlay (getvar "clayer")) (while (and (setq ent (car (entsel "\nSelect object to offset 5 or :"))) (setq pt (getpoint "\nSpecify point on side to offset:")) ) ;_ end and (if (not (tblsearch "Layer" "Membrane")) (command "-layer" "m" "Membrane" "") ) ;_ end if (command "._offset" 5.00 ent "_non" pt "") (setq l1 (entlast)) (command "._offset" 10.00 ent "_non" pt "") (setq l2 (entlast)) (command "_chprop" l1 "" "c" "cyan" "lt" "awthidden2" "la" "Membrane" "") (command "_chprop" l2 "" "c" "red" "lt" "continuous" "la" "Membrane" "") ) ;_ end while (setvar "clayer" oldlay) (princ) ) ;_ end defun Quote
Lee Mac Posted January 22, 2009 Posted January 22, 2009 Would you like to keep the same Layer changing properties as shown in the posted LISP? i.e. Line 1 Layer = "Membrane" Linetype = "awthidden2" Colour = Cyan Line 2 Layer = "Membrane" Linetype = "continuous" Colour = Red Or would you like to specify your own? Quote
Lee Mac Posted January 22, 2009 Posted January 22, 2009 For example, something like this could be modified to suit your needs: (defun c:doff (/ oldDis plSet plLst entlst1 entlst2 delFlg) (vl-load-com) (if (not doffdis) (setq doffdis 10.0)) (setq oldDis doffdis doffdis (getdist (strcat "\nSpecify offset distance <" (rtos doffdis (getvar "LUNITS") (getvar "LUPREC")) ">: "))) (if (not doffdis) (setq doffdis oldDis)) (if (setq plSet (ssget '((0 . "LWPOLYLINE,LINE,ARC,CIRCLE,ELLIPSE,SPLINE")))) (progn (setq plLst (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex plSet))))) (foreach pl plLst (vla-Offset pl doffdis) (setq entlst1 (cons (vlax-ename->vla-object (entlast)) entlst1)) (vla-Offset pl (- doffdis)) (setq entlst2 (cons (vlax-ename->vla-object (entlast)) entlst2))) (foreach ent entlst1 (vla-put-color ent "1")) (foreach ent entlst2 (vla-put-color ent "2")) (initget "Yes No") (setq delFlg (getkword "\nDelete source objects [Yes/No]? <Yes>: ")) (if (null delFlg) (setq delFlg "Yes")) (if (= "Yes" delFlg) (mapcar 'vla-Delete plLst)))) (princ)) (princ "\n*** Type DOFF for doubleside offset *** ") Quote
AustinTECH Posted January 22, 2009 Posted January 22, 2009 cool that works, it would be cool of it uses the layer you have set current. Quote
Lee Mac Posted January 22, 2009 Posted January 22, 2009 This puts the new lines on the current layer: (defun c:doff (/ oldDis plSet plLst entlst1 entlst2 delFlg) (vl-load-com) (if (not doffdis) (setq doffdis 10.0)) (setq oldDis doffdis doffdis (getdist (strcat "\nSpecify offset distance <" (rtos doffdis (getvar "LUNITS") (getvar "LUPREC")) ">: "))) (if (not doffdis) (setq doffdis oldDis)) (if (setq plSet (ssget '((0 . "LWPOLYLINE,LINE,ARC,CIRCLE,ELLIPSE,SPLINE")))) (progn (setq plLst (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex plSet))))) (foreach pl plLst (vla-Offset pl doffdis) (setq entlst1 (cons (vlax-ename->vla-object (entlast)) entlst1)) (vla-Offset pl (- doffdis)) (setq entlst2 (cons (vlax-ename->vla-object (entlast)) entlst2))) (mapcar '(lambda (x) (vla-put-color x 1) (vla-put-layer x (getvar "clayer"))) entlst1) (mapcar '(lambda (x) (vla-put-color x 2) (vla-put-layer x (getvar "clayer"))) entlst2) (initget "Yes No") (setq delFlg (getkword "\nDelete source objects [Yes/No]? <Yes>: ")) (if (null delFlg) (setq delFlg "Yes")) (if (= "Yes" delFlg) (mapcar 'vla-Delete plLst)))) (princ)) (princ "\n*** Type DOFF for doubleside offset *** ") Let me know if you want the colours changed. 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.