Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Re: Multiple pause
« Last post by Lee Mac on Today at 05:56:11 PM »
You can issue the pause in a loop in which the test expression checks whether the command remains active, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. (command "_.pline")
  2. (while (= 1 (logand 1 (getvar 'cmdactive))) (command "\\"))

However, for retrieval of a selection this should not be necessary, as you can simply use (ssget)
2
AutoLISP (Vanilla / Visual) / Solid to surface
« Last post by Amarulu on Today at 02:58:58 PM »
Hi,

Question, is there a direct procedure to get a surface form a solid but the obtained surface shall be in the centre of the solid? In. example for a bracket generated as a solid shall be a surface only showing the bracket shape but with the thickness =0.
3
AutoLISP (Vanilla / Visual) / Multiple pause
« Last post by w64bit on Today at 01:15:25 PM »
Is there any way to add multiple pause, which should work until I click enter (used when select)?
I am using now 20-30 pause words to cover all situations.
4
Trying to learn and migrate to BricsCAD, but have not many documentation.
5
AutoLISP (Vanilla / Visual) / Re: Select all layer change to single layer
« Last post by ribarm on Today at 02:55:59 AM »
@Maystogan,
You have "LAYMRG" command... When Dialog Box pops up, you select all layers to merge, then hit enter, then choose "N" - name to merge layers to - I choose here "0" layer when another Dialog Box pops up... That's all...
In your case after merging to "0" layer, you should create "XR" layer and merge "0" with "XR", or create "XR" layer and simply select "ALL" and change layer property of all entities from "0" to "XR" layer...
6
AutoLISP (Vanilla / Visual) / Select all layer change to single layer
« Last post by Mystogan on May 21, 2024, 09:46:03 PM »
Hi to all,

 

I hope you can assist me in creating a Lisp routine that will systematically change all elements in the architectural layer within the drawing file to the XR layer and set their color to 252. This includes all entities such as blocks, text, etc.; everything must be moved to the XR layer.

 

The drawing should be purged afterward to remove any unused elements. The only exception to this change are the lighting fixtures, which the Lisp routine should prompt the user to specify.

 

I've attached the drawing file in AutoCAD 2018 format for your reference.

 

Thank you in advance for your assistance.

 

Thank you in advance for your assistance.
7
AutoLISP (Vanilla / Visual) / Re: Apply Plot style table to all layout
« Last post by 3dwannab on May 21, 2024, 02:56:38 PM »
Thanks @Lonnie for the correction.

Does anyone know why I get this message on ACAD 2023 and 2025?

This only happens on the first run.
8
AutoLISP (Vanilla / Visual) / Re: Lisp to e-mail content to helpdesk.
« Last post by Lonnie on May 21, 2024, 12:36:38 PM »
I never did Publish the lisp.

Code: [Select]
;; Call IT Helpdesk Script

;; Using Outlook, this script will email selected objects in a temporary DWG file.
;; Credits to Ron Perez (ronjonp) for the Outlook example:
;; http://www.theswamp.org/index.php?topic=26953.msg324794#msg324794
;; http://www.theswamp.org/index.php?topic=55486.0
;; Lonnie Shaw 2020-01-06

;; Enter the Email Addresses Here as Strings
(setq *IT-Email* "lshaw@coname.net"
      *CC-Email* "bsmead@coname.net"
      *BCC-Email* "bseverson@coname.net; dsmith@coname.net; tmcauley@coname.net; jnewton@coname.net; pwyman@coname.net; rstock@coname.net; jarreola@coname.net"
      *Fileset1* (strcat "\nI need assistance from a CAD area Lead. Thank you!"
                         "\nExample file from"
                         "\n" (getvar "dwgprefix")
                         "\"" (getvar "dwgname") "\"")
)

(defun c:CRGhelp (/ _catch cc file outlook email sf si ni)

  ;; Load the Visual LISP extension
  (vl-load-com)

  ;; Define a helper function to catch errors
  (defun _catch (f a) (not (vl-catch-all-error-p (vl-catch-all-apply f a))))

  ;; Alert the user to select objects and send mail from Outlook
  (alert "Please create a scratch file by selecting the elements you are having problems with. \n\nAfter you select objects to mail, remember to send mail from Outlook.")

  (if
    (and
      ;; Get selected objects
      (or (ssget "_I") (prompt "\nSelect object(s) to eMail: ") (ssget))
      ;; Create a temporary DWG file
      (setq file (vl-filename-mktemp "" nil ".dwg"))
      (_catch 'vla-WBlock
              (list (cond (*AcadDoc*)
                          ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))))
                    file
                    (vla-get-activeselectionset *AcadDoc*)))
      ;; Create an Outlook application instance
      (setq outlook (vlax-get-or-create-object "Outlook.Application"))
      (setq sf (vl-catch-all-apply 'vlax-invoke (list (setq ns (vlax-invoke outlook 'GetNameSpace "MAPI")) 'GetDefaultFolder 5)))
      (setq si (vl-catch-all-apply 'vlax-get (list (vlax-get sf 'items) 'count)))
      ;; Create a new email item
      (setq email (vlax-invoke-method outlook 'CreateItem 0))
      ;; Set email subject
      (_catch 'vlax-put (list email 'Subject "Helpdesk Ticket: "))
      ;; Attach the temporary DWG file
      (_catch 'vlax-invoke (list (vlax-get email 'Attachments) 'Add file))
      ;; Add recipients
      (_catch 'vlax-invoke (list (vlax-get email 'Recipients) 'Add *IT-Email*))
      (setq cc (vl-catch-all-apply 'vlax-invoke (list (vlax-get email 'Recipients) 'Add *CC-Email*)))
      (setq bcc (vl-catch-all-apply 'vlax-invoke (list (vlax-get email 'Recipients) 'Add *BCC-Email*)))
      ;; Set recipient types
      (_catch 'vlax-put (list cc 'Type 2))  ;; CC
      (_catch 'vlax-put (list bcc 'Type 3)) ;; BCC
      ;; Set the email body
      (_catch 'vlax-put (list email 'Body *Fileset1*))
    )
    ;; Display the email in Outlook and handle file cleanup
    (progn
      (princ "\nOutlook active...")
      (vlax-invoke email 'Display :vlax-true)
      (if (= (vl-catch-all-apply 'vlax-get (list email 'Sent)) :vlax-true)
          (vl-file-delete file)
          (progn
            (if (= (setq ni (vl-catch-all-apply 'vlax-get (list (vlax-get sf 'items) 'count))) si)
                (vl-file-delete file) ;; No email was added to Sent Items - delete the file
            )
          )
      )
    )
  )
  ;; Release COM objects
  (foreach x (list sf ns email outlook) (and x (vlax-release-object x)))
  (princ)
)



9
AutoLISP (Vanilla / Visual) / Re: Lisp to e-mail content to helpdesk.
« Last post by Lonnie on May 21, 2024, 12:35:44 PM »
Sorry I did not see this.

Here is what I got.

Command: (_GET-USERS-EMAIL-ADDY)
"lshaw@coname.net"

I ran this

Code: [Select]
(defun _get-users-email-addy (/ network user domain conn qry ldaprs fld result)
  (setq result nil) ; Initialize result to nil
  (vl-catch-all-apply
    '(lambda ()
       (setq
         network (vlax-create-object "Wscript.Network")
         user    (vlax-get network 'username)
         domain  (vlax-get network 'userdomain)
         conn    (vlax-create-object "ADODB.Connection")
       )
       (vlax-put conn 'provider "ADsDSOObject")
       (vlax-invoke conn 'open "ADSI")
       (setq
         qry    (strcat "select mail from 'LDAP://" domain "' ")
         qry    (strcat qry "WHERE objectClass = 'user' and ")
         qry    (strcat qry "samAccountName = '" user "'")
       )
       (princ (strcat "\nLDAP Query: " qry)) ; Print the LDAP query for debugging
       (setq ldaprs (vlax-invoke conn 'execute qry))
       (setq fld (vlax-invoke (vlax-get ldaprs 'fields) 'item "mail"))
       (setq result (vlax-get fld 'value))
    )
  )
  (if (eq 'str (type result))
    (progn
      (princ (strcat "\nEmail Address: " result)) ; Print the result for debugging
      result
    )
    (progn
      (princ "\nFailed to retrieve email address.")
      nil
    )
  )
)

and got

AP Query: select mail from 'LDAP://DCE' WHERE objectClass = 'user' and samAccountName = 'lshaw'
Email Address: lshaw@coname.net"lshaw@coname.net"

10
You may be able to do with VL lisp but like the .Net answer would create a cogo point with a description and put it in a CIV3D group say "TEXTS" then can use CIV3D label styles. May be faster to export all the text into a CSV file PXYZD then import file into a group.

If you look into the CIV3D samples deep down in C:\program files\autodesk there may be a VL example of import points. I know they exist, not on CIV3D at moment.
Pages: [1] 2 3 ... 10