Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/08/2024 in all areas

  1. You don't have to be in any specific view. I rarely change my view to Front or Right while working. In fact, I don't even use the Viewcube, I have it turned off. The main thing you have to pay attention to while working in Autocad 3D is where your XY plane is located. If you need to work on the Right side of the model, just rotate your UCS to align the XY plane with the face of the model where you need to work and then continue on.
    1 point
  2. @pkenewell FWIW ;; This (and (= pr "") (= su "")) ;; Could be this (= "" pr su) Also .. I realized that the transparency of a layer is stored as XDATA so: ;; Changing this (setq el (entget (tblobjname "layer" (setq l (cdr (assoc 8 (entget e))))))) ;; To this gets all the layer properties including transparency 8-) (setq el (entget (tblobjname "layer" (setq l (cdr (assoc 8 (entget e))))) '("AcCmTransparency"))) Code updated above.
    1 point
  3. I've just switched all my lisps over to on demand loading, it speeds things up on drawing opening. Biggest hassle is to add new LISPs to the on demand loading file, but once done it is no hassle. I'll probably end up with a 50-50 mix of on demand and pre-loading LISPs. I have a file with the following formated LISPs in, if this routine is called then it loads the relevant file, and then runs the LISP. If the LISP is loaded then usually is is loaded after this file and will run as normal without going through the load (latest loading of the LISP is the one that runs) (defun c:3PARC ( / ) (load "C:\\Users\\SP\\Desktop\\AutoCAD\\AutoCAD LISPS\\LinesToArc.lsp") (c:3PARC) (princ) ;;LISP File / Run LISP ) Could be modified to: (defun acet-ss-drag-move ( ss pt Prompt1 Prompt2 / ) (if (findfile "acetutil.arx") (progn (arxload "acetutil.arx" "\nError - AutoCAD Express Tools Utilities not loaded") (acet-ss-drag-move ss pt Prompt1 Prompt2) ) (Alert "\nAutoCAD Express Tools is Needed for this Function.\nInstall the AutoCAD express tools from the original product install package.") ) (princ) ) Have this file load on start up
    1 point
  4. Thanks I guess the "On Demand Loading" works for some people, but it sure is a pain for some too. Thanks again
    1 point
  5. I did wonder, never seen you post anything really that doesn't work. A second method is often good for other CAD packages, if one thing doesn't work then an older LISP might. (Lees method might work well for one of mine that creates layers with dxf codes, but not checked that for yet, setproperty will also work well)
    1 point
  6. @enthralled I figured out the error - dumb little mistake; I had the wrong variable name when setting transparency to the original layer instead of the new one I have corrected my post above. @ronjonp Nice code - does the job with DXF. I like how you filter out the possible new names on selection. HOWEVER, The new layer names could still exist and NOT be in the selection set. Still - good idea! I have updated my code above to filter out possible already existing new layers from the creation loop. @Steven P While Lee's code is very creative, it is much shorter to use (getpropertyvalue) and (setpropertyvalue). It wasn't working for me due to a code typo, rather then the method.
    1 point
  7. Here's another one I've had around for a while modified to get the transparency too. It's also good to exclude items that already contain the suffix so you don't end up with duplicate suffixes. (defun c:layersuffix (/ a el f l nl s tm) ;; RJP » 2024-05-08 (or (setq f (getenv "RJP_LayerSuffix")) (setq f (strcat "-" (getenv "username")))) (cond ((and (setq f (cond ((/= "" (setq tm (getstring (strcat "\nEnter suffix [<" f ">]: ")))) tm) (f) ) ) (setq s (ssget ":L" (list '(-4 . "<NOT") (cons 8 (strcat "*" f)) '(-4 . "NOT>")))) ) (setenv "RJP_LayerSuffix" f) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq el (entget (tblobjname "layer" (setq l (cdr (assoc 8 (entget e))))) '("AcCmTransparency")) ) (or (tblobjname "layer" (setq nl (strcat l f))) (entmakex (subst (cons 2 nl) (assoc 2 el) el)) ) (entmod (subst (cons 8 nl) (assoc 8 (entget e)) (entget e))) ) ) ) (princ) )
    1 point
  8. @enthralled A little trickier with getting and setting transparency - but almost all can be done fairly easily with Visual LISP Activex functions. ;; New version by Pkenewell. Uses Visual LISP & ActiveX ;; Updated 5/8/2024 to check for existing layers already with new name. (defun C:CNL ( / acdoc cnt el la llst lt lw lyrs np nl ss su tr) (vl-load-com) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) lyrs (vla-get-layers acdoc) ) (vla-StartUndoMark AcDoc) (if (and (setq ss (ssget ":L")) (/= (setq su (getstring T "\nEnter suffix for new layers for selected objects: ")) "") ) (progn (repeat (setq cnt (sslength ss)) (setq el (entget (ssname ss (setq cnt (1- cnt)))) la (cdr (assoc 8 el)) ) (if (not (member la llst))(setq llst (cons la llst))) ) (foreach n llst (if (not (tblsearch "LAYER" (strcat n su))) (progn (setq ob (vlax-ename->vla-object (setq el (tblobjname "LAYER" n))) col (vla-get-truecolor ob) lt (vla-get-linetype ob) lw (vla-get-lineweight ob) np (vla-get-plottable ob) nl (vla-add lyrs (strcat (vla-get-name ob) su)) tr (getpropertyvalue el "Transparency") ) (vla-put-truecolor nl col) (vla-put-linetype nl lt) (vla-put-lineweight nl lw) (vla-put-plottable nl np) (setpropertyvalue (vlax-vla-object->ename nl) "Transparency" tr) ) ) ) ) ) (vla-EndUndoMark AcDoc) (princ) )
    1 point
  9. 1 point
  10. Thank a lot, Lee. Cheers, PP.
    1 point
×
×
  • Create New...