Jump to content

Leaderboard

  1. BIGAL

    BIGAL

    Trusted Member


    • Points

      15

    • Posts

      19,652


  2. GLAVCVS

    GLAVCVS

    Community Member


    • Points

      10

    • Posts

      655


  3. Saxlle

    Saxlle

    Community Member


    • Points

      4

    • Posts

      183


  4. BlackBox

    BlackBox

    Trusted Member


    • Points

      4

    • Posts

      5,329


Popular Content

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

  1. In lisp there is a function AUTOLOAD that does just that loads a lisp based on a command typed on the command line. So you just need a single lisp that has all the autoload commands in it. That custom lisp is loaded on startup in my case its Appload and add to Startup suite. I called my lisp "Autoload.lsp" Here is sample code. You may need to add the start defun name (c:Yourlisp) as last line in the lisp that is loaded, as the load command can be anything and not necessarily the command to run it. eg ZZZ (autoload "COPY0" '("COPY0")) (autoload "COPYCOMMAND" '("ZZZ")) (autoload "COVER" '("COVER")) (autoload "DIMFLIP" '("DIMFLIP")) (autoload "DRAWXFALL" '("DRAWXFALL")) (autoload "DRAWPIPE" '("DRAWPIPE")) (autoload "EDITRL" '("EDITRL"))
    2 points
  2. Hi Like @Stevenp, I can't verify exactly what this is about either: I'm not in front of a PC. But it looks like the last SPoint is 'nil' because '(+ Counter ForwardVisDistance)' is a number greater than the length of 'selPline'. There are a few lines of code that are unnecessary, but they don't prevent your routine from working, so just try changing (while (< Counter SelPline_Length) to (while (and (setq EPoint (vlax-curve-getPointAtDist SelPline (+ Counter ForwardVisDistance))) (setq SPoint (vlax-curve-getPointAtDist SelPline Counter))) It looks like you used AI to do this, but you should still be able to remove the excess code after making these changes.
    2 points
  3. LT does support ActiveX/COM, but cannot interface with objects outside of the AutoCAD Object Model.
    2 points
  4. @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
  5. I have used just a lisp name not a path in the autoload. All our customisation was in one directory on a server, it did though have sub directory's lisp blocks icons etc. Yes if you have Acad need to add trusted paths. (if (> (vl-string-search "BRICSCAD" (strcase (getvar 'product))) 0) (princ "Bricscad not found") (progn (setq oldtrust (getvar 'trustedpaths)) (if (wcmatch oldtrust "*XXX*") (princ) (setvar 'trustedpaths (strcat oldtrust ";" "c:\\XXX-CAD-TOOLS")) ) ) ) (command "workspace" "save" "" "y") ; a good idea is have a new workspace say user name (alert "\nSupport and trusted paths added")
    1 point
  6. I use this for layer 0 at the end of a LISP. (command "_.LAYER" "_Set" "0" "") Error: Bad DXF group: (10) means that the application has attempted to create an entity with wrong vertices (a polyline with a single vertex, identical endpoints for a line, etc.). https://www.cadforum.cz/en/error-bad-dxf-group-10-tip9081 I think you could be passing 2D points when a 3D points are expected, but I won't be able to take a better look until Monday sometime. Most likely in the... ;----- Function to create Forward Visibility Polylines P.S. Just for the record, what exactly is this LISP supposed to do? Can you post an example drawing? P.S.S. Do you have a link or a copy of the original LISP?
    1 point
  7. I incorporated nanoflann( https://github.com/jlblancoc/nanoflann) wrappers into PyRx. Although other efficient KD-Tree implementations exist in Python, such as pykdtree, the wrapper is specifically designed for AcGePoint2d/AcGePoint3d, eliminating the need for type conversions. How can these structures be beneficial in CAD? in this example, we search for a phone within a certain radius of each computer. Additionally, we can identify computers that do not have phones. We could also do something like, search all MTexts on the Layer "Employee" to determine whether they are near a chair, phone, or computer. import traceback from pyrx import Ap, Ax, Db, Ed, Ge, Gi, command # radiusSearch @command def doit(): db = Db.curDb() phones, computers = getBlocks(db) result = [] # create the tree of phone locations phonePoints = Ge.Point3dArray() for phone in phones: phonePoints.append(phone[1]) phoneTree = Ge.Point3dTree(phonePoints) # search for nerby phones for computer in computers: idxs, _ = phoneTree.radiusSearch(computer[1], 50 * 50)# sqrd if len(idxs) == 0: print("no phone") continue for idx in idxs: result.append((computer, phones[idx])) for cpu, phn in result: Ed.Core.grDraw(cpu[1], phn[1], 2, 0) # helper, store the id and position def getBlocks(db: Db.Database): phones = [] computers = [] model = Db.BlockTableRecord(db.modelSpaceId()) refs = [Db.BlockReference(id) for id in model.objectIds(Db.BlockReference.desc())] for ref in refs: if ref.getBlockName() == "COMPUTER": computers.append((ref.objectId(), ref.position())) elif ref.getBlockName() == "FNPHONE": phones.append((ref.objectId(), ref.position())) return phones, computers
    1 point
  8. Ignoring the code for the moment, "Civil Site Design" has check site lines and it checks against the terrain model and the vertical alignment, not just a 2D answer. Looks at the drivers eye height and target height which is part of the check for us here in AUS.
    1 point
  9. Very interesting, did something similar, I made a "where are they" map, it had a grid over the office floor so had a big staff list Bigal lev 5, A 1. I used the phone number as a link to an image of each staff member, so their picture appeared on their desk I simply saved each staff image as the extension number. It was reasonably fast making the new dwg inserting around 100 photo's per floor we worked in a 5 story building.
    1 point
  10. Sounds like on the last run through the while loop SPoint is having an error... if you look at (setq SPoint (vlax-curve-getPointAtDist SelPline (+ Counter inc))) - do you need this line since at the start of the next loop you are setting SPoint again and before it is used.
    1 point
  11. @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
  12. 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
  13. Did you try to hard code the full path to the .pc3? i.e. C:PathtoPC3folder/Foxit PDF Editor Printer.pc3
    1 point
  14. I moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the appropriate forum.
    1 point
  15. Yes, correct, I meant on that
    1 point
  16. 1 point
  17. @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
  18. Just one detail: it might be necessary to replace 'acLineSpacingStyleAtLeast' with 1 for MLEADERs as well.
    1 point
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. @BlackBox I am glad to see you contributing once again in all around similar forums. It's been a long time indeed.
    1 point
  28. Thanks for the clarification, my friend.
    1 point
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. You can also try with showhtmlmodalwindow.
    1 point
  35. 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
  36. 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
  37. 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
  38. Providing you have made a menu and it sits on the server, that will call the lisps. You just need to load that CUIX on each pc. If you add more to that menu, load it so it makes a new CUIX, when a user starts there CAD the latest CUI or CUIX will be loaded. Ok the only other thing you need to do is add the server support paths to each pc. This way you can use just a lisp name not its full path address in your menu. By having all the lisps on the server you control if they are changed or new ones added and always the latest version. Finally I have a setup.lsp it does all the add support paths and load the new menu. So takes like 10 seconds as it sits on the server. Ask if you want more info. Just a comment this menu has some 130 lisps behind it. One of 2 for civil works. As suggested we also had some lisps that were autoloaded on startup. Appload "Startup Suite" but we did not load every lisp we had, used the menu for that.
    1 point
  39. Hi I’m attaching the code. But first, a brief explanation of how it works. The function is implemented by calling MiGRTexto with one parameter: the desired height for the real-time texts (this should be a value between 0.5 and 1) Therefore, it can be placed inside a main function that can be called from the command line (e.g., (defun c:myCommand)). As for the code that provides functionality, it's actually very simple: it consists of a text next to the right CROSSHAIR and an MTEXT below it. These must be properly managed so that they dynamically update their size, location and content—it's that straightforward. From there, it’s just a matter of adding code to achieve whatever final functionality the user needs. In the attached code, a small emulator for the "pline" command is implemented, triggered by a LEFT CLICK event. This event calls funcionPrincipal, which is provided with two arguments: the screen point indicated and the entity name (or nil) of the object under the PICKBOX at that location. These two arguments should be enough to enable any subsequent operation. It’s important to note that the entire behavior relies on GRREAD, and therefore on mouse and keyboard events. These events are handled using several clauses within a cond expression, which can be extended or modified by the user. I haven’t implemented any code to add object snap functionality. Doing so would considerably complicate the code, and for some users, it may not be necessary. In any case, suggestions and improvements (regarding snapping or any other proposals) are welcome in this thread—for those (myself included) who may want to improve or add new features. I won’t go on any further. Now, the code... ;******************* p o r d e s í a r g o ******************** ;************************ G L A V C V S ************************* ;************************** F E C I T *************************** (defun MiGRTexto (factor / l se e le txTmp txTmp1 txOk tam p pa pt pt1 i? v1 polil alt tx para erroria errores error0 textoGR1 textoGR2 funcionPrincipal) (defun erroria () (defun errores (mens) (setq *error* error0) (vla-delete txTmp) (vla-delete txTmp1) (redraw) (if e (redraw e 4)) (prin1) ) (setq error0 *error* *error* errores ) ) (defun funcionPrincipal (pt e) (setvar 'LASTPOINT pt) ;;;INICIO(START) EMULAD(T)OR "pline" (if polil (entmod (append (entget polil) (list (cons 10 pt)))) (if (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 8 "0") (cons 90 2) '(70 . 128) '(62 . 256) (cons 10 pa) (cons 10 pt) ) ) (setq polil (entlast)) ) ) (setq pa pt) ;;;FIN(END) EMULAD(T)OR "pline" ) (defun textoGR1 () ;THIS FUNCTION RETURN TEXT STRING TO DISPLAY ABOVE CURSOR. ADJUST IT TO SUIT YOUR NEEDS ;ESTA FUNCIÓN DEVUELVE EL TEXTO A MOSTRAR SOBRE EL CURSOR. MIDIFÍCALA SEGÚN LO NECESITES (rtos (distance (getvar 'LASTPOINT) p) 2 3) ) (defun textoGR2 (lp / lp MT) ;ESTA FUNCIÓN DA EL FORMATO NECESARIO AL MTEXT QUE SE MOSTRARÁ BAJO EL CURSOR (foreach l lp (if MT (setq MT (strcat MT (car l) " {\\fLucida Sans Unicode|b0|i0|c0|p34;\\C4;" (cadr l) "}")) (setq MT (strcat (car l) " {\\fLucida Sans Unicode|b0|i0|c0|p34;\\C4;" (cadr l) "}")) ) (setq MT (if (equal l (last lp)) MT (strcat MT "\\P"))) ) ) (defun dameGRT2 (le / cl to) ;THIS FUNCTION RETURN THE LIST OF PAIRS THAT textoGR2 NEEDS TO FORMAT CONTENTS OF MTEXT. ADJUST IT TO SUIT YOUR NEEDS ;ESTA FUNCIÓN DEVUELVE LA LISTA DE PARES QUE NECESITA textoGR2 PARA GENERAR LA CADENA DE TEXTO QUE NECESITA EL MTEXT (list (list "Object" (setq to (cdr (assoc 0 le)))) (list "Layer" (cdr (assoc 8 le))) (list "Color" (if (setq cl (cdr (assoc 62 le))) (itoa cl) "BYLAYER")) (list "XData?" (if (assoc -3 le) "YES" "NO")) ) ) (erroria) (setq txTmp (vla-AddText (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) "0" (VLAX-3D-POINT '(0 0)) 0.1) txTmp1 (vla-AddMText (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point '(0 0)) 5000 "0") i? T ) (vla-put-color txTmp 1) (vla-put-visible txTmp 0) (vla-put-color txTmp1 2) (vla-put-visible txTmp1 0) (while (and (not para) (setq l (grread nil 13 0))) (setq tam (* (getvar "PICKBOX") (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE"))) 2 factor ) ) (if e (redraw e 4)) (setq e (if (setq se (if (listp (setq p (cadr l))) (nentselp p))) (if (and (not (member (vlax-ename->vla-object (car se)) (list txTmp txTmp1))) (member (cdr (assoc 0 (setq le (entget (car se) '("*"))))) '("LWPOLYLINE" "POLYLINE" "LINE" "SHAPE" "3DFACE" "INSERT" "TEXT" "MTEXT" "ATTRIB") ) ) (car se) ) ) ) (if (and i? e) (vla-put-visible txTmp1 1) (vla-put-visible txTmp1 0)) (prompt (strcat "\rLWPOLYLINE mode: " (if pa "next" "first") " point... (Press \'F10\' for " (if i? "DEACTIVATE" "ACTIVATE") " real-time reporting)")) (cond ((= (car l) 5) (if (not v1) (setq v1 (vla-put-visible txTmp 1) v1 T)) (setq pt (list (+ (car p) (* tam 0.8)) (+ (cadr p) (/ tam 2.2)))) (redraw) (if pa (grvecs (list 7 pa p))); THIS LINE IS PART OF THE "pline" EMULATOR CODE. DISABLE IT IF YOU DONT WANT TO USE THE EMULATOR IMPLEMENTED IN funcionPrincipal ; ESTA LINEA FORMA PARTE DEL EMULADOR "pline". DESACTIVALO SI ELIMINAS EL CÓDIGO EMULADOR IMPLEMENTADO EN funcionPrincipal (vlax-put-property txTmp 'InsertionPoint (vlax-make-variant (vlax-3d-point pt))) (vlax-put txTmp 'Height tam) (vlax-put txTmp 'TextString (textoGR1));<<<-- MODIFICAR ESTA LINEA DE CÓDIGO PARA QUE 'TextString MUESTRE EL TEXTO DESEADO (if (and i? e) (progn (redraw e 3) (setq pt1 (list (car pt) (- (cadr p) (/ tam 2.)))) (vlax-put-property txTmp1 'InsertionPoint (vlax-make-variant (vlax-3d-point pt1))) (vlax-put txTmp1 'Height tam) (vlax-put txTmp1 'TextString (textoGR2 (dameGRT2 le))) ) ) ) ((= (car l) 3) (if pa (funcionPrincipal p (car se)) (setq pa p))); ((= (car l) 25) (setq para T)); BOTON DERECHO = SALIR ((member (cadr l) '(67 99)) (if polil (setq para (entmod (subst (cons 70 1) (assoc 70 (entget polil)) (entget polil)))))); ((= (cadr l) 21) (setq i? (not i?))) ;;; AQUI DEBAJO EL CODIGO PARA GESTIONAR EL RESTO DE OPCIONES ;;; BELOW YOU CAN ADD MORE CLAUSES TO 'cond' TO EXTEND THE CODE FUNCTIONALITY (T ;REST OF CASES: WE DO NOTHING ) ;| .... .... |; ) ) (vla-delete txTmp) (vla-delete txTmp1) (redraw) (if e (redraw e 4)) (princ) )
    1 point
  40. After seeing @BIGAL's suggestion, I'm wondering if I understood correctly what you're asking, Vica. Anyway, I'm attaching a short clip of what I'm talking about. FACTVM de ARCTIS.mp4 I’ve implemented a small emulator of the "pline" command in the base code, but each user should implement the code they need for their specific task instead. Basically, the distance variation from the last stored point in LASTPOINT is displayed above the cursor (though this can be easily changed by modifying the textoGR1 function). Below the cursor, any desired information about the object under it will be shown (or not, if visibility is toggled by pressing the F10 key). This information must be passed to the textoGR2 function as a list of (Property_Name StringValue) pairs. The main code must be implemented in the 'FuncionPrincipal' function.
    1 point
  41. @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
  42. This tutorial may be of some help: Prompting with a Default Option.
    1 point
  43. I wrote elsewhere like renderman that we used to add the serial numbers to our lisp code and then use protect (PS do you want a copy of "unprotect" its not real good protection) any way there is a simple way to add the serial checking to your code using the operating system you can write a batch file (txt file) that copies the serial code to every lisp file you have then protects it. Batch file copy serial.lsp+mylisp1.lsp mylisp1protect.lsp Protect mylisp1protect.lsp f:\lisp\mylisp1.lsp keep repeating for all lisps The serial lsp could just look for a file somewhere say if you work on a network like Companyname. It a nucianse if someone borrows the code so they know they have done the wrong thing when they read a message then lisp exit's (exit) found a copy (setq run (getvar "_pkser")) (if (or (= run "123-22341988")(= run "123-123560429")) (princ "\nSecurity check passed") (progn (princ "\nYou have tried to run my software on a non authorised machine") (princ "\nPlease contact me on 123 4560789") (/e) ) ) It does work had some one ring up once who was trying to install on a friends machine. Word of warning though if you lock the code it must still work after your gone or get new pc's etc
    1 point
×
×
  • Create New...