Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/22/2023 in all areas

  1. A maybe method is to draw a temp line in a direction form the center of the arc changing a few degrees per try, you have a start and end angle in an ARC its built in, so just add a repeat count and a limit on how far to look. If your picking the arc and text even easier as the text to center point angle must fall within the start and end angles. Arc can do some things like save the arc in the opposite direction to what you have drawn. So need a dwg to check. Confirm auto or pick.
    1 point
  2. Did not look at code but for future reference "0 height" in CAD is referred to as "Elevation". So can set the current plane Z value, For your 3dpoly I think its at current Elev value, but its a flat plane all at that Z value.
    1 point
  3. I use pdmode all the time as just remember 1 number.
    1 point
  4. Another for a non recatngular shape. (ssget "CP" (list pt1 pt2 pt3 pt4 pt1))
    1 point
  5. @Engineer_Yasser look at this ;; https://www.cadtutor.net/forum/topic/66203-numbering-along-path/#comment-543810 (if (minusp (sin (- (angle '(0 0 0) vec_pt) (angle '(0 0 0) vec_path)))) (setq tmp_3 (distance tmp_1 %)) (setq tmp_3 (* -1 (distance tmp_1 %))) )
    1 point
  6. Check whether the distance from the text to the arc center is greater than the arc radius.
    1 point
  7. some ssget like "_W" need other infromation to work. in this case it needs two points Lower left and upper right of a rectangle. (ssget "_W" '(3 2) '(5 4)) This will select anything that is 100% inside the rectangle that goes from (3,2) to (5,4) More here or here --Edit (ssget "_X") - is selecting everything in the drawing and doesn't need points. (ssget) - is waiting for you to make a selection by default
    1 point
  8. (defun c:SYSINFO ( / getiplist iplist ipv6list driveindex drivetxt noofdrive drivesr) ;https://www.theswamp.org/index.php?topic=42276.0 (defun getip ( / WMI CSERV EXQ gip) (vl-load-com) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")) (setq CSERV (VLAX-INVOKE WMI 'ConnectServer "." "\\root\\cimv2" nil nil nil nil nil nil)) (setq EXQ (vlax-invoke CSERV 'ExecQuery "Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = true")) (vlax-for item EXQ (setq gip (vlax-get item 'IPAddress)) ) (vlax-release-object wmi) (vlax-release-object CSERV) (vlax-release-object EXQ) gip ) ;https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/?do=findComment&comment=540967 (defun Get_BaseBoardSerialNumber (/ LocatorObj ServiceObj ObjectSetObj SerialNumber) (setq LocatorObj (vlax-create-object "WbemScripting.SWbemLocator") ) (setq ServiceObj (vlax-invoke LocatorObj 'ConnectServer nil nil nil nil nil nil nil nil) ) (setq ObjectSetObj (vlax-invoke ServiceObj 'ExecQuery "Select * from Win32_BaseBoard" ) ) (vlax-for Obj ObjectSetObj (setq SerialNumber (vlax-get Obj 'SerialNumber) ) ) (foreach Obj (list LocatorObj ServiceObj ObjectSetObj) (and Obj (vlax-release-object Obj)) ) SerialNumber ) ;https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/?do=findComment&comment=540992 (defun Get_ProcessorId (/ LocatorObj SecurityObj SecurityObj ObjectSetObj Processor_Id ) (setq LocatorObj (vlax-create-object "WbemScripting.SWbemLocator") ) (setq ServiceObj (vlax-invoke LocatorObj 'ConnectServer nil nil nil nil nil nil nil nil) ) (setq ObjectSetObj (vlax-invoke ServiceObj 'ExecQuery "Select * from Win32_Processor" ) ) (vlax-for Obj ObjectSetObj (setq Processor_Id (vlax-get Obj 'ProcessorId) ) ) (foreach Obj (list LocatorObj ServiceObj SecurityObj ObjectSetObj) (and Obj (vlax-release-object Obj)) ) Processor_Id ) ;https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/?do=findComment&comment=540993 (defun Get_UUID (/ LocatorObj ServiceObj ObjectSetObj UUID) (setq LocatorObj (vlax-create-object "WbemScripting.SWbemLocator") ) (setq ServiceObj (vlax-invoke LocatorObj 'ConnectServer nil nil nil nil nil nil nil nil) ) (setq ObjectSetObj (vlax-invoke ServiceObj 'ExecQuery "SELECT UUID FROM Win32_ComputerSystemProduct" ) ) (vlax-for Obj ObjectSetObj (setq UUID (vlax-get Obj 'UUID) ) ) (foreach Obj (list LocatorObj ServiceObj ObjectSetObj) (and Obj (vlax-release-object Obj)) ) UUID ) ;https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/?do=findComment&comment=540994 (defun SerialInfo_BIOS (/ WMI meth1 meth2 serial) (vl-load-com) (cond ((and (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")) (setq meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)) (setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select * from Win32_" "BIOS"))) (vlax-for itm (vlax-get (vlax-invoke meth2 'ItemIndex 0) 'Properties_) (if (eq (vlax-get itm 'name) "SerialNumber") (setq serial (vlax-get itm 'value))))))) (mapcar 'vlax-release-object (list meth1 meth2 wmi)) serial) ;https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/?do=findComment&comment=540995 (defun get_macaddress (/ Locator Server Query ret) (if (and (setq Locator (vlax-create-object "WbemScripting.SWbemLocator")) (setq Server (vlax-invoke Locator 'ConnectServer "." "root\\cimv2")) (setq Query (vlax-invoke Server 'ExecQuery "select * from Win32_NetworkAdapterConfiguration where IPEnabled = True"))) (vlax-for item Query (setq ret (vlax-get item 'MacAddress)))) (foreach obj (list Locator Server Query) (vl-catch-all-apply 'vlax-release-object (list obj))) ret) ;https://www.cadtutor.net/forum/topic/9848-how-to-get-serial-number-of-hard-drive-by-lisp/?do=findComment&comment=79829 ;;; * ;;; PART OF 'ASMILIB' LIBRUARY * ;;; Created: 07.10.2007 * ;;; Last modyfied: 07.10.2007 * ;;; ⓒ Alexanders Smirnovs (ASMI) * ;;; * ;;; ********************************* ;;; **** PC Hardware Functions ****** ;;; ********************************* ;;; * ;;; Retrieves Hard Drive serial number * ;;; * ;;; Arguments: * ;;; Path - Path of Hard Drive, for example "C:" (string) * ;;; * ;;; Output: * ;;; Hard Drive serial number (integer) or NIL in case of error. * ;;; * (defun #Asmi_Get_Drive_Serial (Path / fsObj hSn abPth cDrv) (vl-load-com) (if (and (setq fsObj(vlax-create-object "Scripting.FileSystemObject")) (not (vl-catch-all-error-p (setq abPth(vl-catch-all-apply 'vlax-invoke-method (list fsObj 'GetAbsolutePathName Path)) ); end setq ); end vl-catch-all-error-p ); end not ); end and (progn (setq cDrv(vlax-invoke-method fsObj 'GetDrive (vlax-invoke-method fsObj 'GetDriveName abPth ); end vlax-invoke-method );end vlax-invoke-method ); end setq (if (vl-catch-all-error-p (setq hSn(vl-catch-all-apply 'vlax-get-property (list cDrv 'SerialNumber)))) (progn (vlax-release-object cDrv) (setq hSn nil) ); end progn ); end if (vlax-release-object fsObj) ); end progn ); end if hSn ); end of #Asmi_Get_Drive_Serial ;https://www.theswamp.org/index.php?topic=44425.0 (defun _ping (address / out ws) (if (setq ws (vlax-get-or-create-object "WScript.Shell")) (progn (setq out (vlax-invoke ws 'run (strcat "ping.exe -n 1 " address) 0 :vlax-true)) (and ws (vlax-release-object ws)) (zerop out) ) ) ) (if (_ping "google.com") (setq internetping "Yes") (setq internetping "No")) (setq getiplist (getip)) (setq iplist (LM:str->lst (vl-princ-to-string (car getiplist)) " ")) (setq ipv6list (LM:str->lst (vl-princ-to-string (cadr getiplist)) " ")) ;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/hard-drive-number-in-lisp/m-p/902962/highlight/true#M128620 (defun vl-finddrive (/ DriveList) (foreach Item '("Z" "X" "Y" "V" "W" "U" "T" "S" "R" "Q" "P" "O" "N" "M" "L" "K" "J" "I" "H" "G" "F" "E" "D" "C" "B" "A") (if (= (vl-file-size (strcat Item ":/")) 0.0) (setq DriveList (cons (strcat Item ":/") DriveList)) );end if );end foreach DriveList );end vl-finddrive ;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/decimal-to-hexadecimal/m-p/2874070/highlight/true#M293991 (defun STD-NUM->HEX (i / s a) (setq s "") (while (> i 0) (setq a (rem i 16) i (lsh i -4) ) ;_ setq (setq s (strcat (if (< a 10) (chr (+ 48 a)) ; 48: (ascii "0") (chr (+ 55 a)) ) ;_ if s ) ;_ strcat ) ;_ setq ) ;_ while ) ;_ defun ;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/list-to-string/m-p/830687/highlight/true#M56345 (defun strlcat (delim lst) (apply 'strcat (cons (substr (car lst) 1 1) (mapcar '(lambda (x) (strcat delim (substr x 1 1)) ) (cdr lst) ) ) ) ) (setq noofdrive (length (vl-finddrive))) (setq drivetxt "") (setq driveindex 0) (repeat noofdrive (setq drivesr (strcat (substr (setq sn (dos_serialno (nth driveindex (vl-finddrive)) )) 1 4) "-" (substr (setq sn (dos_serialno (nth driveindex (vl-finddrive)) )) 5 4))) (setq drivetxt (strcat drivetxt "\n " (substr (nth driveindex (vl-finddrive)) 1 1) " Drive Serial = " (vl-princ-to-string drivesr) )) (setq driveindex (+ driveindex 1)) ) ;(princ drivetxt) (setq infomsg (strcat " Internet Connection = " (vl-princ-to-string internetping) "\n IP = " (vl-princ-to-string (caddr iplist)) "\n IPv6 = " (vl-princ-to-string (caddr ipv6list)) "\n Log-on Server = " (vl-princ-to-string (getenv "LOGONSERVER")) "\n Computer Name = " (vl-princ-to-string (getenv "COMPUTERNAME")) "\n User Name = " (vl-princ-to-string (getenv "USERNAME")) "\n MainBoard Serial = " (vl-princ-to-string (get_baseboardSerialNumber)) "\n Processor ID = " (vl-princ-to-string (Get_ProcessorId)) "\n UUID = " (vl-princ-to-string (Get_UUID)) "\n BIOS Serial = " (vl-princ-to-string (SerialInfo_BIOS)) "\n MAC Address = " (vl-princ-to-string (get_macaddress)) "\n Connected Drive = " (vl-princ-to-string (strlcat ", " (vl-finddrive))) drivetxt ) ) (princ infomsg) ;; Popup - Lee Mac ;; A wrapper for the WSH popup method to display a message box prompting the user. ;; ttl - [str] Text to be displayed in the pop-up title bar ;; msg - [str] Text content of the message box ;; bit - [int] Bit-coded integer indicating icon & button appearance ;; Returns: [int] Integer indicating the button pressed to exit (defun LM:popup ( ttl msg bit / wsh rtn ) (if (setq wsh (vlax-create-object "wscript.shell")) (progn (setq rtn (vl-catch-all-apply 'vlax-invoke-method (list wsh 'popup msg 0 ttl bit))) (vlax-release-object wsh) (if (not (vl-catch-all-error-p rtn)) rtn) ) ) ) (LM:popup "PC System Info" infomsg (+ 0 64 4096)) (princ) ) I've put together some nice code written by dilan, for beginners like me. Others have also been collected and links have been attached. command is SYSINFO - Drive serial is not manufacturer's unique serial number. this can be change with just formatting
    1 point
  9. (defun get_macaddress (/ Locator Server Query ret) (if (and (setq Locator (vlax-create-object "WbemScripting.SWbemLocator")) (setq Server (vlax-invoke Locator 'ConnectServer "." "root\\cimv2")) (setq Query (vlax-invoke Server 'ExecQuery "select * from Win32_NetworkAdapterConfiguration where IPEnabled = True"))) (vlax-for item Query (setq ret (vlax-get item 'MacAddress)))) (foreach obj '(Locator Server Query) (vl-catch-all-apply 'vlax-release-object (list obj))) ret)
    1 point
  10. (defun c:SerialInfo_ BIOS(/ WMI meth1 meth2 serial) (vl-load-com) (cond ((and (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")) (setq meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)) (setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select * from Win32_" "BIOS"))) (vlax-for itm (vlax-get (vlax-invoke meth2 'ItemIndex 0) 'Properties_) (if (eq (vlax-get itm 'name) "SerialNumber") (setq serial (vlax-get itm 'value))))))) (mapcar 'vlax-release-object (list meth1 meth2 wmi)) serial)
    1 point
  11. (defun Get_UUID (/ LocatorObj ServiceObj ObjectSetObj UUID) (setq LocatorObj (vlax-create-object "WbemScripting.SWbemLocator") ) (setq ServiceObj (vlax-invoke LocatorObj 'ConnectServer nil nil nil nil nil nil nil nil) ) (setq ObjectSetObj (vlax-invoke ServiceObj 'ExecQuery "SELECT UUID FROM Win32_ComputerSystemProduct" ) ) (vlax-for Obj ObjectSetObj (setq UUID (vlax-get Obj 'UUID) ) ) (foreach Obj (list LocatorObj ServiceObj ObjectSetObj) (and Obj (vlax-release-object Obj)) ) UUID )
    1 point
  12. (defun Get_ProcessorId (/ LocatorObj SecurityObj SecurityObj ObjectSetObj Processor_Id ) (setq LocatorObj (vlax-create-object "WbemScripting.SWbemLocator") ) (setq ServiceObj (vlax-invoke LocatorObj 'ConnectServer nil nil nil nil nil nil nil nil) ) (setq ObjectSetObj (vlax-invoke ServiceObj 'ExecQuery "Select * from Win32_Processor" ) ) (vlax-for Obj ObjectSetObj (setq Processor_Id (vlax-get Obj 'ProcessorId) ) ) (foreach Obj (list LocatorObj ServiceObj SecurityObj ObjectSetObj) (and Obj (vlax-release-object Obj)) ) Processor_Id )
    1 point
  13. (defun Get_BaseBoardSerialNumber (/ LocatorObj ServiceObj ObjectSetObj SerialNumber) (setq LocatorObj (vlax-create-object "WbemScripting.SWbemLocator") ) (setq ServiceObj (vlax-invoke LocatorObj 'ConnectServer nil nil nil nil nil nil nil nil) ) (setq ObjectSetObj (vlax-invoke ServiceObj 'ExecQuery "Select * from Win32_BaseBoard" ) ) (vlax-for Obj ObjectSetObj (setq SerialNumber (vlax-get Obj 'SerialNumber) ) ) (foreach Obj (list LocatorObj ServiceObj ObjectSetObj) (and Obj (vlax-release-object Obj)) ) SerialNumber )
    1 point
  14. Search here for "Triangulation" start with TriangV0.5.9.LSP by YMG there may be newer versions this goes back to 2014. ;; Version V0.5.8 ; ;; C:TIN, Generates Delaunay Triangulation and Voronoi Diagram. ; ;; C:CONT, Generates Contours from a sset of 3DFACES. ; ;; C:GEN, Generates a bunch of points for testing. ; ;; C:DEMOZ, Demo of locating yourself in a triangulation. ; ;; C:LBL, Generates Label on Major Contour at regular spacing. ; ;; C:FLBL, Generates Label on All Contours along Fence Lines. ; ;; C:DLBL, Generates Label Dynamically (Based on Alan JT routine) ; ;; C:PROF, Generates a Longitudinal Profile. ; ;; C:XSHAPE, (Chi-shape) Generates a concave boundary around triangulation ;
    1 point
  15. ;;; * ;;; PART OF 'ASMILIB' LIBRUARY * ;;; Created: 07.10.2007 * ;;; Last modyfied: 07.10.2007 * ;;; © Alexanders Smirnovs (ASMI) * ;;; * ;;; ********************************* ;;; **** PC Hardware Functions ****** ;;; ********************************* ;;; * ;;; Retrieves Hard Drive serial number * ;;; * ;;; Arguments: * ;;; Path - Path of Hard Drive, for example "C:" (string) * ;;; * ;;; Output: * ;;; Hard Drive serial number (integer) or NIL in case of error. * ;;; * (defun #Asmi_Get_Drive_Serial(Path / fsObj hSn abPth cDrv) (vl-load-com) (if (and (setq fsObj(vlax-create-object "Scripting.FileSystemObject")) (not (vl-catch-all-error-p (setq abPth(vl-catch-all-apply 'vlax-invoke-method (list fsObj 'GetAbsolutePathName Path)) ); end setq ); end vl-catch-all-error-p ); end not ); end and (progn (setq cDrv(vlax-invoke-method fsObj 'GetDrive (vlax-invoke-method fsObj 'GetDriveName abPth ); end vlax-invoke-method );end vlax-invoke-method ); end setq (if (vl-catch-all-error-p (setq hSn(vl-catch-all-apply 'vlax-get-property (list cDrv 'SerialNumber)))) (progn (vlax-release-object cDrv) (setq hSn nil) ); end progn ); end if (vlax-release-object fsObj) ); end progn ); end if hSn ); end of #Asmi_Get_Drive_Serial
    1 point
×
×
  • Create New...