Jump to content

Leaderboard

  1. BIGAL

    BIGAL

    Trusted Member


    • Points

      8

    • Posts

      19,646


  2. GLAVCVS

    GLAVCVS

    Community Member


    • Points

      7

    • Posts

      654


  3. BlackBox

    BlackBox

    Trusted Member


    • Points

      4

    • Posts

      5,329


  4. Saxlle

    Saxlle

    Community Member


    • Points

      4

    • Posts

      183


Popular Content

Showing content with the highest reputation since 06/27/2025 in all areas

  1. LT does support ActiveX/COM, but cannot interface with objects outside of the AutoCAD Object Model.
    2 points
  2. @NanGlase To further assess the possibilities of the "license server" option in real time from AutoCAD, the following needs to be considered: At the code level, you must: Check that both the client PC and your own have the same communication port available, and if not, handle this somehow. Also ensure that the firewall will not block the ports on either the client or the server side. At the infrastructure level, you must: Have a static IP or a domain name on the server side so that your code, when executed by the client, knows where to send the request. In my opinion, although this is an interesting challenge, you should assess whether the effort and investment required are justified by the benefits you may gain. I believe that, considering all of this, the most reasonable options might be those proposed by @Steven P and @BIGAL.
    2 points
  3. Hi everyone, Semi-long time listener, first time caller. I wanted to say thanks for the help and tips I got from this site over the past 6 months. As I have been working on two autolisps, one called P0 the other P9. The do the same thing, kinda. P0 will pull the dwgname field and save it to the clipboard, allowing me to use it wherever without have to flip to the folders . . pick the file . . . hit F2 . . CTRL+C . . . then go back. P9 does the same thing, but adds dwgprefix + dwgname. I work in a third-party firm that uses several client projects with their different CAD standards. Some forbid using fields in the titleblocks for various reasons and like them hard coded. P9 is useful for when I'm jumping between sub-folders and need to plot to source folders. I can't use the PDFExport feature, as different clients use different standards and I need to make sure everything is good before going for each plot, mostly for peace of mind. I wanted to share these with you guys as a thank you and giving back to the community. My autolisps learning is only about 4 - 5 months old. FYI, I didn't know till literally a few days ago, from this very site, that one can right click the tab for the copy full path. lol P9.lsp P0.lsp
    2 points
  4. @Steven P Hi bro, I have tried this and modified but I don't know is this right. (defun PC3Name ( / ) ;; Name of custom Plot Configuration PC3 File ;; This is the Plot Configuration PC3 file used when you check the 'Preview PDF' checkbox ;; otherwise it uses 'DWG to PDF.pc3' "Foxit PDF Editor Printer.pc3" ) (defun PC3Loc ( / PCP PC3LOC ) ;; Location of custom Print Configuration PC3 files ;; Note standard and no preview PC3 files are to be in the same location (setq PC3Loc (vla-get-PrinterConfigPath (vla-get-Files (vla-get-Preferences (vlax-get-acad-object))))) PC3LOC ) (defun PDFgetplottername ( pdfpreview / pname PC3FilePath ) ;; Get the correct plotter name based on preview or not (setq pname "DWG to PDF.pc3") ;; Default fallback (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name)))) (setq pname (PC3Name)) ) (if (= pdfpreview "N") (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP)))) (setq pname (PC3NameNP)) ) ) pname ) (defun PC3Exists (pc3name / fullpath) (setq fullpath (strcat (PC3Loc) "\\" pc3name)) (findfile fullpath) ) (defun C:PDF1 ( / cm pc3name paperName ) (vl-load-com) (setq cm (getvar 'CMDECHO)) (setvar 'CMDECHO 0) ;; Define your desired PC3 file and paper size (setq pc3name "Foxit PDF Editor Printer.pc3") (setq paperName "ARCH D") ;; or exact size from your PC3 ;; Only proceed if the PC3 file exists (if (PC3Exists pc3name) (progn (command "_.-plot" "_y" (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB)) pc3name paperName "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "Free State.ctb" "_Y" ) (if (= 1 (getvar 'TILEMODE)) (command "_A") (command "_N" "_Y") ) (command "_N" (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME)) ".pdf") "_Y" "_Y" ) ) (prompt (strcat "\nPC3 file not found: " pc3name)) ) (setvar 'CMDECHO cm) (princ) ) But after that it shows like "Command: PDF1 PC3 file not found: Foxit PDF Editor Printer.pc3" The custom.pc3 file were saved in same as the default file/location. I don't know what I did wrong.
    1 point
  5. For PC3 files, if I remember, I couldn't get LISP to create one so you'll need to set them all up and save the configuration files. It would help if you save them in the default file location A couple of snippets I have, This gives the default PC3 file location: (defun PC3Loc ( / PCP PC3LOC) ;;Location of custom Print Configuration PC3 files ;;modify if you want a different location from the default AutoCAD location ;;Note standard and no preview PC3 files are to be in the same location for it to work well. (setq PC3Loc (vla-get-PrinterConfigPath (vla-get-Files (vla-get-Preferences (vlax-get-acad-object))))) PC3LOC ) This one checks that the PC3 file exists - defined in the PC3NAME lisp (defun PC3Name ( / ) ;;Name of custom Plot Configuration PC3 File ;;This is the Plot Configutation PC3 file used when you check the 'Preview PDF' checkbox ;;otherwise it uses 'DWG to PDF.pc3' "DWG to PDF.pc3" ) (defun PDFgetplottername( pdfpreview / pname) ;;this needs to be set up in pagesetup settings (setq pname "DWG to PDF.pc3") ;;Default DWG to PDF plotter (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name))) ) (setq pname (PC3Name)) );;end if (if (= pdfpreview "N") ;;get custom PC3 file name (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP))) ) (setq pname (PC3NameNP)) );;end if );;end if pname ) where my Dwg to PDF.PC3 is my PDF plotter setting file
    1 point
  6. Did you try to hard code the full path to the .pc3? i.e. C:PathtoPC3folder/Foxit PDF Editor Printer.pc3
    1 point
  7. I moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the appropriate forum.
    1 point
  8. Yes, correct, I meant on that
    1 point
  9. 1 point
  10. @GLAVCVS, I tryed with "acLineSpacingStyleAtLeast", where the default value is 1 (acLineSpacingStyleAtLeast = 1). But, if you want different number than "1", definetly need to change "acLineSpacingStyleAtLeast" with desired value. As always, you're the man, thanks!
    1 point
  11. Just one detail: it might be necessary to replace 'acLineSpacingStyleAtLeast' with 1 for MLEADERs as well.
    1 point
  12. Hi @masterfal, I don't know what do you want to achieve with this: (vl-catch-all-apply (function (lambda () (setq mtextObj (vlax-invoke ent 'GetMText)) (if mtextObj (progn (setq newText (vla-AddMText (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-get-insertionpoint mtextObj) (vla-get-width mtextObj) (vla-get-TextString mtextObj) ) ) but there is several issues in this code, like: 'GetMText doesn't exist as Method, you can't use "acLineSpacingStyleAtLeast" as variable to store the value, etc. You can try with this: (defun c:LSFsel ( / ss i ent obj acLineSpacingStyleAtLeast mtextObj newText) (vl-load-com) (if (setq ss (ssget)) (progn (setq i 0) (while (< i (sslength ss)) (setq ent (vlax-ename->vla-object (ssname ss i))) (cond ;; MText: apply directly ((= (vla-get-objectname ent) "AcDbMText") (vla-put-LineSpacingStyle ent 1) (vla-put-LineSpacingFactor ent 0.8) ) ;; MLeader: rebuild MText ((= (vla-get-objectname ent) "AcDbMLeader") (vla-put-TextLineSpacingStyle ent acLineSpacingStyleAtLeast) (vla-put-TextLineSpacingFactor ent 0.80) ) ) (setq i (1+ i)) ) (princ "\n? Line spacing factor set to 0.8 for selected items.") ) (princ "\n?? No objects selected.") ) (princ) ) Try it, and see if it's helpful.
    1 point
  13. Like others write same script file all the time then only one ever exists. Part 2 I reset my temporary directory to a top level "d:\acadtemp" much easier to find, you may be horrified as to how much junk is in there. To reset or find, Options, Files,"Temporary directory"" Save Multi toggles to a support directory as its auto loaded. cleanup temp.lsp Multi toggles.lsp
    1 point
  14. Wish this were modeless instead of modal, so you could switch between them. Browser command, and startapp + explorer + url work fine. Webload command is really neat, but most don't do Javascript/HTML.
    1 point
  15. Have you looked at using a script ? Basically its a multi line file with extension .SCR, it would be like this. It just executes every line opening and closing dwg files. open DWG1 (load "myfixlisp") Open dwg2 (load "myfixlisp") open dwg3 (load "myfixlisp") Google "script writer" You may be able to pick a directory and write the script, then run it, using a lisp. Lee-mac has a good "get a list of dwgs in a directory".
    1 point
  16. What is obvious is that non of the responders probably have a LT2024+. So again to @p7q can you copy this one line to the command line of your LT and let us know if it works. It may only open a web site but may be useful. (command "browser" "https://maps.google.com.au" ) As a part time user of Powershell that may be one way around the API call as does LT allow for "Shell" ie open a bat file. Another test should open Notepad. (command "shell" "Notepad") The more tests you do for us the more we may be able to help.
    1 point
  17. Just type PS at the command line and hit Enter. That will switch you to paper space and then you can zoom out.
    1 point
  18. like lido said In AutoLISP, cannot directly check for Windows Admin privileges, because AutoLISP is sandboxed within AutoCAD and cant see those types of windows things. tho I wouldn't try and copy files into sys folder. because if you do (admin rights) you would have a bunch of junk files in there. then the next step is to delete the copied file. that is a hop skip and a jump away from delete something needed. I suggest using cmd prompt. it can list admin users and you can output that to a txt file that autocad can then read. if user name true. something like "net localusers administrators > c:\admintest.txt"
    1 point
  19. Thanks, @Tharwat! We had a child, who's about to start kindergarten in a few weeks, we've moved, we have new jobs... so my priorities are (I am) different. Cheers
    1 point
  20. @BlackBox I am glad to see you contributing once again in all around similar forums. It's been a long time indeed.
    1 point
  21. Thanks for the clarification, my friend.
    1 point
  22. IMHO, if you're not using Visual Studio Community (free) or familiar with .NET API, you really should stop asking for .NET code, as you won't be able to do anything with it even if someone gives it to you. We do not keep the original plines, but can always get them back... here's an old LISP that I've since ported to .NET as a ContextMenu (right click menu) to quickly extract polylines for one or more Alignments. Since C3D Alignment object's EndingStation and StartingStation properties are read-only for LISP API, OP should use something like this, combined with (command "._lengthen" "_t") to set the total length, or (command "._lengthen" "_de") to increase/decrease overall length, then manually modify the Alignment via grips or remove/add geometry. (vl-load-com) (defun c:GetAlgnPlines (/ *error* acDoc clayer ss) (defun *error* (msg) (if ss (vla-delete ss)) (if acDoc (vla-endundomark acDoc)) (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) ) (if (ssget "_:L" '((0 . "AECC_ALIGNMENT"))) (progn (vla-startundomark (setq acDoc (vla-get-activedocument (vlax-get-acad-object))) ) (setq clayer (getvar 'clayer)) (vlax-for x (setq ss (vla-get-activeselectionset acDoc)) (vla-put-layer (vlax-invoke x 'getlwpolyline) clayer) ) ) ) (*error* nil) ) Viewing the source code first may help reduce reluctance in the future: https://www.jetbrains.com/decompiler/# FWIW, CopIlot uses ChatGPT, so it really depends on your subscription as to which tier/models you have access to. As example, with M365 subscription you have access to ChatGPT-4 model (specifically the GPT-4-turbo variant), which is better than the free ChatGPT models (last I checked), but having a ChatGPT subscription provides you access to better models. HTH
    1 point
  23. Lt may not support "GetInterfaceObject", it is not a full lisp version lots of stuff does not work. @p7q did you try what I posted ?
    1 point
  24. Just a quick comment where I used to work we used a simple check inside say a FAS, no remote check, we had a phone call from a client who said code was not working. Ok the reason he was trying to give the programs to some one else, so our security worked.
    1 point
  25. Incremental Numbering Suite Version 4.0 Released. The main feature of the new version is the introduction of a dedicated 'Content Builder' to facilitate the construction of an incrementing string from an arbitrary number of incrementing and/or static components. With this feature, the user now has the ability to independently control the increment amount and increment frequency for each component of the string, enabling multiple sections of the string to increment by different amounts and at different rates to one another. The new version also introduces the ability to load & save application configurations, streamlining the operation of the program for multiple numbering systems.
    1 point
  26. You can via lisp send yourself an email with the code in it. I would scramble the code. Give client a fas file to run. You can send to a remote server a file, likewise can read a file from a remote server, a bit harder and if your pc is off the code will fail. Have tested this. Re Install from a usb, I had a zip file and a install.lsp, The install lisp unzips all the files to a known directory, yes can unzip a file using lisp, it menuloads the menu and adds support paths. Happy to provide an example. I use this method for multiple users at one company they just email the two files to each user and they drag and drop the lisp. (defun pingserver ( / xml str) (setq server "http://myserver.com.au/TestInfo.txt") ; I would change this to get passed a unique filename (setq xml (vlax-create-object "MSXML2.XMLHTTP.3.0")) (vlax-invoke-method xml 'open "POST" server :vlax-false (vlax-invoke-method xml 'send) (setq str (vlax-get-property xml 'responsetext)) ; got your file !!!!! ;do your bit here )
    1 point
  27. You can also try with showhtmlmodalwindow.
    1 point
  28. AutoCAD licensing AutoCAD, in real time. Who could resist reading a bit more? Well, yes. Confirmed: this is possible. How? As I said before, through PowerShell (managed from Lisp, of course), but in a more elegant way than using 'sendCommand': with 'setVariable'. The idea is to have our Lisp write a script (.ps1) that creates a lightweight server to listen on a port. AutoCAD PC1 sends a request message to AutoCAD PC2, which processes it and sends a reply back to AutoCAD PC1. Receiving this message triggers the loading of a DCL with a textbox (showing the received code) and an Accept button to register that code. And how do you trigger the DCL upon receiving the message? Think of a detonator: 'setVariable'... and then think of the explosive: 'vlr-sysvar-reactor'. Sounds good? "If you can imagine it, you can build it. And improve it."
    1 point
  29. Sorry even i am away until 9 july. However thanks for your help .
    1 point
  30. @SLW210 Yes, these scripts are LT friendly. Cheers for making Cadtutor a great forum. @Steven P Thank you Steven for your input, I'm eager to give it a try. Over the past few weeks, I couldn't get the v-lax routines to work, I came to the conclusion it was an LT limitation. But your code looks different, I will try yours the next time I'm in the office, which is sometime next week. (Long weekend for me up here in Canada ) In my haste, I made a mistake. The scripts below, Q1 and Q2, just add the dwgname and full path with name to the clipboard respectively that's it. The P0 and P9 do the same but also call the plot dialog box automatically for the user. I won't re-add the P scripts, see above. To verify: Q1 - adds dwgname to the clipboard Q2 - adds dwgprefix + dwgname to the clipboard P0 - adds dwgname to the clipboard and calls the plot dialog P9 - adds dwgprefix + dwgname to the clipboard and calls the plot dialog Have a great weekend. Q1.lsp Q2.lsp
    1 point
  31. Sorry for the delay 'real' work got in the way : ) Dang .. I can't get an animated GIF to load at the moment:
    1 point
  32. Nice. I use these for clipboard, always good to see other ways of doing things. You need both lines for each ;;Copy text to clipboard ;;(vlax-invoke (vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'setData "TEXT" --MYTEXTSTRING-- ) ;;(vlax-release-object html) ;;and release the object ;;Get text from clipboard ;;(vlax-invoke (vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData) 'getData "TEXT" ) ;;(vlax-release-object html) ;;and release the object
    1 point
  33. USB: I have the below from RJP. Send an e-mail. There are 2 LISPs below, the first c:sendmail describes the process and the second is a function I call to send e-mails via LISP (usually sending PDFs). Create a little LISP that will return to whatever unique number you want, after that use the below to send you an e-mail with the unique code in - this can be done in the background using Outlook ('send' needs to be 'T'). At your leisure you can put that number into your master LISP, compile it and send the LISP back again for the end user to copy where they want. (rjp-OutlookMessage (<<YOUR-E-MAIL>> "Computer Code" "" <<UNIQUE-CODE>> T) T might need to be "T" Removes the need for you to take the USB to the users desk. ;;http://www.theswamp.org/index.php?topic=26953.msg324794#msg324794 ;;email a file ;;Usage (defun c:sendemail () ; test and example e-mail (rjp-OutlookMessage ;;email address (multiple separated by semicolon) "Some.One@e-mail.com;someone.else@e-mail.com" ;;Subject "Test Email" ;;Attachments as a list of strings '("C:\\Users\\SO123456\\Working Drawings\\ADrawing.pdf") ;;Text in body of email "Nothing to read here :)" ;;nil will open email to edit...T will send email in the background nil ) ) (defun rjp-OutlookMessage (To Subject AttachmentList Body Send / objMail objOL) (if (and (setq objOL (vlax-get-or-create-object "Outlook.Application")) (setq objMail (vlax-invoke-method objOL 'CreateItem 0)) ) (progn (vlax-put objMail 'To To) (vlax-put objMail 'Subject Subject) (vlax-put objMail 'Body Body) (foreach file AttachmentList (vl-catch-all-apply 'vlax-invoke (list (vlax-get objMail 'Attachments) 'Add file ) ) ) (if send (vlax-invoke objMail 'Send) (vlax-invoke objMail 'Display :vlax-true) ) (vlax-release-object objOL) (vlax-release-object objMail) ) ) (princ) ) Second thought for today, how much risk is there to send the LISP out without any protection in the form of computer codes ad so on? For example, all of mine are done on company time, their property and happy to freely share within the company. What I post here I put down to 'learning time' (always learning)... a lot of the users of this thread are the same with little commercial or sensitive info in the LISP... so... what is the risk and do you need to do any more than just compile the code (and even compile the code... do you need to do that)?
    1 point
  34. Autodesk has an Entitlement API if you’re planning on using the app store See Using Entitlement API with Lisp https://adndevblog.typepad.com/autocad/2022/05/using-entitlement-api-with-lisp.html I have a couple of apps there that uses it, it’s pretty cool. Otherwise, it’s not worth spending a lot of time on this, its code that you have to maintain. Keep it simple, something like an XOR cipher and the drive serial is going to be enough. you can store this in the registry or a license file.
    1 point
  35. Do a google lots of code out there can be as simple as. (command "browser" "https://maps.google.com.au" ) ; opera house -33.8567844,151.213108,17z (command "browser" "https://www.google.com.au/maps/@-33.8567844,151.213108,17z") Not tested in LT. Works in Bricscad.
    1 point
  36. A lisp version hope fully works in LT. Change the xxx and path etc. (setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object)))) (setq paths (vla-get-SupportPath *files*)) (if (wcmatch paths "*XXX*") (princ) (vla-put-SupportPath *files* (strcat "C:\\XXX-CAD-TOOLS" ";" paths)) ) Copy the 1st two lines to the command line as a test in LT. You should see a list of your support paths C:\\Users\\XXXX\\AppData\\Roaming\\Bricsys\\BricsCAD\\V25x64\\en_US\\Support;D:\\Bricsys\\BricsCAD V24 en_US\\Support; Oh yeah if using Autocad need to add trusted paths, Trusted paths is a bit of why ? As you can set the paths so why have it. (if (> (vl-string-search "BricsCAD" (getvar 'acadver)) 0) (princ "Bricscad") (progn (setq oldtrust (getvar 'trustedpaths)) (if (wcmatch oldtrust "*XXX*") (princ) (setvar 'trustedpaths (strcat oldtrust ";" "c:\\XXX-CAD-TOOLS")) ) ) )
    1 point
  37. wow!! i cut paste that into the search bar and it immediately fired up using my last template ! brilliant i will have a play thank you.
    1 point
  38. Are you using AutoCAD 2022 as your profile shows?
    1 point
  39. This returns the serial number of the motherboard. It is more unique than the hard drive's serial number and also more unique than the variant of this same function that uses "Select * from Win32_BaseBoard". (defun obt_UUID (/ LObj SObj OSObj UUID) (setq LObj (vlax-create-object "WbemScripting.SWbemLocator") SObj (vlax-invoke LObj 'ConnectServer nil nil nil nil nil nil nil nil) OSObj (vlax-invoke SObj 'ExecQuery "SELECT UUID FROM Win32_ComputerSystemProduct") ) (vlax-for Obj OSObj (setq UUID (vlax-get Obj 'UUID)) ) (foreach Obj (list LObj SObj OSObj) (and Obj (vlax-release-object Obj)) ) UUID ) This might be a good option if you want your program to continue working when the user changes their hard drive but not their motherboard.
    1 point
  40. @PGia I went out for my 40-50 km bike ride today and I've been thinking about this for a while. I tried OVERKILL-MR and I admit I wasn't able to figure out the right ranges to remove the excess without causing any damage to the rest of the drawing (perhaps someone can prove otherwise). For this reason, in my opinion, I think you should look for another solution. I assume your ultimate goal is to have a clean drawing on which to create a polygon topology. To do this, use '_mapclean' in C3D, activating the options in 'Cleanup Actions': - Delete duplicates - Erase short objects - Break crossing objects - Dissolve pseudonodes Repeat this 2 or 3 times. I don't think this will solve all the problems. But it will leave the drawing ready for you to try creating a polygon topology. The problematic polylines that remain in the drawing will appear with each attempt to create the topology. It's a laborious but safe process. I imagine you're confused because you suddenly have to do something you haven't done before. But I think you'll have no choice but to waste a little time learning.
    1 point
×
×
  • Create New...