Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Detail Buggble LISP

  1. #11
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Detail Buggble LISP

    FWIW -

    The Layers Collection Object's Add() Method will get, or create the Layer based upon the layerName string supplied as parameter, from which one can simply set the Color, Linetype, Lineweight Properties, etc.

    This would result in the appropriate Layers being 'set' to standard each time the LISP were invoked... And preclude the need for one more Command call.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  2. #12
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Detail Buggble LISP

    That's .NET yes? A little out of my league I'm afraid.

  3. #13
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Detail Buggble LISP

    Quote Originally Posted by jpcadconsulting347236 View Post
    That's .NET yes? A little out of my league I'm afraid.
    It can be (I also code .NET plug-ins), but actually I was describing the Visual LISP (ActiveX) approach.

    Quick demonstration... Please take from it what you like:

    Code:
    (vl-load-com)
    
    (defun c:FOO (/ *error* clayer acDoc layerName oLayer)
    
      (defun *error* (msg)
    
        ;; restore the stored layer, even in the event of an error
        (and clayer (setvar 'clayer clayer))
    
        ;; end undo mark
        (if acDoc (vla-endundomark acDoc))
    
        ;; handle any error messages
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      ;; store the current layer
      (setq clayer (getvar 'clayer))
    
      ;; start undo mark
      (vla-startundomark
        (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
      )
    
      ;; get or create layer
      (setq oLayer (vla-add (vla-get-layers acDoc) (setq layerName "_FOO")))
    
      ;; set standard layer properties
      (vla-put-color oLayer 110)
      (vla-put-description oLayer "_FOO Description ")
      (vla-put-linetype oLayer "bylayer")
      (vla-put-lineweight oLayer aclnwt050)
      ;;<-- set other properties here
    
      ;; set the layer current
      (setvar 'clayer layerName)
    
      ;; demonstrate
      (alert
        (strcat "\nYou'll notice that \""
                layerName
                "\" layer has been set current (look over there). "
        )
      )
    
      ;; clean exit
      (*error* nil)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Repeating detail - can't use a detail with other nested detail components?
    By patricks in forum Revit Architecture - Families
    Replies: 4
    Last Post: 2011-11-12, 03:35 AM
  2. Replies: 6
    Last Post: 2011-07-07, 08:25 PM
  3. Re-associate detail view labels with re-imported detail sheets
    By pgastelum77763 in forum AutoCAD Sheet Set Manager
    Replies: 0
    Last Post: 2007-01-12, 06:18 PM
  4. Replies: 4
    Last Post: 2005-12-06, 04:17 PM
  5. Lisp for detail boundry and Mark
    By shelby in forum AutoLISP
    Replies: 2
    Last Post: 2004-10-07, 06:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •