Recent Posts

Pages: [1] 2 3 ... 10
1
Trying to learn and migrate to BricsCAD, but have not many documentation.
2
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...
3
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.
4
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.
5
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)
)



6
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"

7
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.
9
I am trying to think of a way to convert Dtext or Mtext to a Civil 3D label simply by selecting the text.  Some drawings come to me that have static text and I want to be able to convert these text objects to Civil 3D general Labels simply by clicking on them.  I understand I can use annotative text styles, but I would rather have them as general C3D labels.
10
Thank you Marko Ribar !
Pages: [1] 2 3 ... 10