Jump to content

Search the Community

Showing results for tags 'lisp'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 467 results

  1. Hi guys & gals, I came across a very repetitive problem. While working with a certain type of software data is output to *.dxf as set of 3D polylines and text. From the level of software I work with, I cannot configure any text formatting details. Hence an idea to ask You few questions. 1. Is there any way of rotating text based on azimuth of a 3Dpolyline which lies within 0.3m distance from the text base? Did someone ever came across LISP of this type ? 2. is there any other (more effective) way than OVERKILL to get a rid of duplicated text ? Thank you in advance ! Regards, Adam, Geophysicist.
  2. Hi, I am trying to find a way to label points with its own layer name like the attached lisp commando. It does it with line/polylines. Also I am trying to find a way to do this with multiple points, therefore the rotation of the imported mtext does not need to be aligned. Could anyone help me find a way to edit the code downstairs or help me with a new code? (defun alg-ang (obj pnt) (angle '(0. 0. 0.) (vlax-curve-getfirstderiv obj (vlax-curve-getparamatpoint obj pnt ) ) ) ) (defun C:LL (/ *error* acsp adoc ang fld midp mtx rot sset txtpt) (defun *error* (msg) (if (vl-position msg '("console break" "Function cancelled" "quit / exit abort" ) ) (princ "Error!") (princ msg) ) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object) ) ) (princ) ) (or adoc (setq adoc (vla-get-activedocument (vlax-get-acad-object) ) ) ) (if (and (= (getvar "tilemode") 0) (= (getvar "cvport") 1) ) (setq acsp (vla-get-paperspace adoc)) (setq acsp (vla-get-modelspace adoc)) ) (vla-startundomark adoc ) (if (setq sset (ssget "_:L" (list (cons 0 "*LINE,ARC,CIRCLE,ELLIPSE")))) (foreach obj (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex sset)))) (if (not (eq "AcDbArc" (vla-get-objectname obj))) (setq midp (vlax-curve-getclosestpointto obj (vlax-curve-getpointatparam obj ( / (- (vlax-curve-getEndParam obj) (vlax-curve-getStartParam obj)) 2)) ) ) (setq midp (vlax-curve-getclosestpointto obj (vlax-curve-getpointatdist obj ( / (vla-get-arclength obj) 2))) ) ) (setq ang (alg-ang obj midp)) (if (> pi ang (/ pi 2)) (setq ang (+ ang pi)) ) (if (> (* pi 1.5) ang pi) (setq ang (+ ang pi)) ) (setq rot (+ ang (/ pi 2))) (setq txtpt (polar midp rot (if (zerop (getvar "dimtxt")) 0.1 (/ (getvar "dimtxt") 2))) ) (setq fld (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-objectid obj)) ">%).Layer>%") ) (setq mtx (vlax-invoke acsp 'AddMText midp 0.0 fld) ) (vlax-put mtx 'AttachmentPoint 8 ) (vlax-put mtx 'InsertionPoint txtpt ) (vlax-put mtx 'Rotation ang ) ) ) (princ) ) (princ "\n\t\t\tType LL to label curves with layer name\t") (prin1) (vl-load-com) ll-Label A line with its own layer name.txt
  3. Dear all, Do you have a lisp to labelling horizontal line or vertical line coordinate, just the line's Northing or Easting coordinate parallel to line ,it can be above ,under or on line, can chose location. and can labelling several lines one time. thanks a lot.
  4. I've been looking for a routine that will allow me to transfer an attribute from one block to another. Ideally I'd like to click on one block which contains the attribute I want (from a field called ID_1), then click on another block and copy the attribute to another specific field (ID_2). I need to do this to quite a few blocks so I'd like to just continue to click between the two types of block. I thought I could modify the code on this page http://www.cadtutor.net/forum/showthread.php?32085-Need-Lisp-to-update-attributes, but this appears to place the same attribute on every block I click. Any help is greatly appreciated!
  5. Hi guys, I have 3d polyline net system as you can see down below, trying to measure every cell automatically (see attachment), problem is that net is 3 dimensional and hard to define measuring angular, every 3d polyline is individual (see attachment) just want to select the 3d polyline and giving measures between nodes, do anyone know how to solve this puzzle an easiest way? Best Regards
  6. Hello guys, I'm about to update my code in order to make it more efficient. A long time ago I wrote this function to save my custom values in an XRECORD inside a dictionary. Is it possible to have the number of parameters (300-301-302- and so on) depending on the length of the list? (DEFUN CP:salva_dati (name nomedizionario lst / dict_name anXrec) (SETQ dict_name (CP:get-or-create-Dict "C_plan")) ;(CDR (ASSOC -1 (DICTSEARCH (NAMEDOBJDICT) nomedizionario)))) (SETQ anXrec (ENTMAKEX (LIST '(0 . "XRECORD") '(100 . "AcDbXrecord") (CONS 300 (nth 0 lst)) ;percorso (CONS 301 (nth 1 lst)) ;unità (CONS 302 (nth 2 lst)) ;scala (CONS 303 (nth 3 lst)) ;scala colore (cons 304 (nth 4 lst)) ;moltiplicatore (cons 305 (nth 5 lst)) ;ang_rot ) ) ) (DICTADD dict_name name anXrec) ) (defun CP:get-or-create-Dict ( nome / adict) (if (not (setq adict (dictsearch (namedobjdict) nome))) (progn (setq adict (entmakex '((0 . "DICTIONARY")(100 . "AcDbDictionary")))) (if adict (setq adict (dictadd (namedobjdict) nome adict))) ) (setq adict (cdr (assoc -1 adict))) ) ) In this case, I can save 6 values. I want to use this function to save even only one value or 10 values without creating other dedicated functions. Is it possible? Any suggestion to accomplish that? Another question: to edit these xrecord I usually get values that don't modify and createa list of them plus values that I want to change. (setq lst (list (CP:leggi_dati "Costanti" "C_plan" 300) "M" "1" "1000" "0.01" (CP:leggi_dati "Costanti" "C_plan" 305) ) ) (dictremove (cdr (assoc -1 (dictsearch (namedobjdict) "C_plan"))) "Costanti") (CP:salva_dati "Costanti" "C_plan" lst) (DEFUN CP:leggi_dati (name nomedizionario valore / dict_name) (SETQ dict_name (CDR (ASSOC -1 (DICTSEARCH (NAMEDOBJDICT) nomedizionario)))) (CDR (ASSOC valore (DICTSEARCH dict_name name))) ) There is a better method? (modify only the element I want without collect the others) Thanks for your help! Dennis
  7. Dear all, I'm looking for a simple lisp (probably vlisp) routine that can select all leaders of the same type (e.g dot). In other words, i only want to select the dot leaders of all my leaders in the drawing file. Should look something like this: (ssget "x" ("leader")) and ('leadertype 3) Thanks
  8. I've been trying to implement an error handler into the attached lisp, but i'm just too stupid to get it to work. I'm trying to get the lisp to reset the coordinate system (UCS) and Osnap setting to where they were before executing the program. If anyone could help me out with this, i would highly appreciate it. GEO9_RTOS_2dec.LSP
  9. Hello, I apologize if my terminology is off as I generally do not work in CAD/LISP. I am working on a lisp routine that draws blocks and adds attributes to the blocks (labels). I set the blocks to be a solid hatch and set their colour with (setvar "cecolor" "255"). After I finished I realized it would be nice to add the ability to draw the blocks without fill if the user wishes. I thought their would be a system variable something like (setvar "transparency" "100") but I can't find anything. Does anyone know how to set the transparency of block fill using LISP or how to set the colour to NULL? Thanks
  10. Good Morning All, All of our drawings are produced in 2D AutoCAD, generally building elevations, roof plans and sectional details. What I want to be able to do is measure a dimension on the plan of a roof, but, use a lisp to apply a factor to this so that the output dimension shows the length at the pitch of the roof... In other words if the plan dimension was 5000mm, but the roof pitch was known to be 10 degrees, the output of that dimension would show 5077mm. Or, at 15 degrees, the output would show 5176mm, etc, etc. What I would also like to do is apply this lisp individually or to a group of dimensions. Hope this makes sense!!
  11. Noklu

    Sort contours

    I am looking for a routine to sort contour lines. I am using 3d polylines that I import from Global Mapper. My problem is all of the lines are on one layer. Ideally, I would like to pick a starting elevation (polyline) and have the routine select every 5th contour up and down. Once then are all selected, I can move them to a new layer (like TOPO-INDEX). Some of these sites are hundreds of acres and have significant elevation changes. To do this by hand is VERY time-consuming (and easy to miss some contours). I am not a programmer, but this seems like the type of task that is ideal for a lisp routine. Any help is appreciated.
  12. Hi All Members Please Please help me for text on Polyline with block Sorry for English S2_A1_CS_LIST_FINAL.dwg
  13. Hello all, I work for a Firm that does Commercial Architectural Drafting and I am currently looking for a simple way to add a lisp routine that allows us to automatically calculate New doors on Floor plans and Parking Spaces on site plans that we create. Reason being that we are just looking for a faster way to do this without counting each individual door or parking space to save time and energy. Not sure if this is possible because I do not have extensive knowledge in Lisp Routines but this seemed like the right place to ask. If anyone knows anything about this that would be helpful. Thank you and have a great day.
  14. Dear Team, Greetings..! I have multiple drawings in one .dwg file in Model (Ref. UNIT 4500.JPG file). I need to covert PDF's with help of "Page Setup Name" Each name Plot area selected. (Ref. Page Setup.jpg file). the converted pdf file with name of same as Page setup name & automatically saved in WRT to Unit path.(Ref. Path.JPG) Kindly help me out I have hundreds of drawing to covert every time of small correction..!!
  15. I'm wanting to create a way to quickly change the layers of a CADworx object. This is what I have so far but its not working like I want. The problem is no matter how many objects I select, it only changes the first then stops working completely. If I try to run it again and select another object it wont do anything. I need to be able to select objects manually. Can someone point me in the right direction? (defun C:ttt () (setq STL_SS nil) (graphscr) (setq STL_SS (ssget '((0 . "LINE")(8 . "CL_Steel"))));;;FIND ALL THE LINES ON LAYER CL-STEEL (setq CL_CNT 0) (if (/= STL_SS nil) (repeat (sslength STL_SS) (setq STL_NAME (ssname STL_SS CL_CNT)) (setvar "pickstyle" 0) (command "chprop" STL_NAME "" "LA" "BEAM_CL" "") (setq CL_CNT (1+ CL_CNT)) );;;repeat );;;if (setq STL_SS nil) (setq STL_SS (ssget "L" '((0 . "3DSOLID")(8 . "STEEL"))));;;FIND ALL THE SOLIDS ON LAYER STEEL (setq CL_CNT 0) (if (/= STL_SS nil) (repeat (sslength STL_SS) (setq STL_NAME (ssname STL_SS CL_CNT)) (command "chprop" STL_NAME "" "LA" "BEAM" "") (setq CL_CNT (1+ CL_CNT)) );;;repeat );;;if (setvar "pickstyle" 1) (princ) )
  16. Does anyone have any information on DraftSight and the use of lisps and setting variables, these are two separate questions. I currently can load a lisp and run them as I do in AutoCad but there are limitations/variations to certain things. Does anyone have a comparison or know the differences with the two programs? My next question is about setting variables in DraftSight, Command Line: (setq no1 10) returns 10, but when I invoke !no1 it returns Error: No Function. as if the value got wiped immediately after being set. Is there a System Variable I need to set to hold these variables or is it just not possible in DraftSight? Any information is much appreciated.
  17. aban

    Ortho with 45 degrees

    Hello, is there any way to get ortho to also include 45 degrees? I know polar tracking has the different angles, but I would need ortho to do that. If not, is there a way to make a lisp file to assign "DD" to turn that lisp file on? Please help with this because I really need this to work. Thank you!
  18. Hi. The following routine generates the exception e06d7363 when using (* push-error-using-command *). If I replace "myerror" (* push-error-using-command *) with (* push-error-using-stack *) and the "command" with "command-s", the exception is not generated; but when activating "myerror" the message is generated that indicates that I must use (* push-error-using-command *) or command-s. (defun test (a b / ) (entradaTest) ;;(*push-error-using-command*) (/ a b) (setq *DrawingGER* (vla-get-ActiveDocument (vlax-get-acad-object))) (setq LayersColeccion (vlax-get-property *DrawingGer* "Layers")) ;;Crea las layer necesarias para alojar las entidades del dibujo. (setq ListaLayers (list "Make_Tuberias" "Biseles" "3D_Perfil")) ;;Funcion: AX-EXISTE+. ;;Parametro "elemento" es una cadena con el nombre de elemento a buscar en una coleccion, ej (ax-existe+ "0" "LAYERS"). ;;Archivo iList.lsp (foreach X ListaLayers (if (not (ax-Existe+ X "Layers")) (vl-cmdf ".-layer" "New" X "T" X "")) ) (salidaTest) ;;(*pop-error-mode*) ) (defun myerror (s) (if (/= s "Function cancelled") (princ (strcat "\nError GER: " s)) ) (setvar "cecolor" color_org) (setvar "cvport" port_view_ger) (command "_vpoint" vpoint_ger) (command "_zoom" "W" MSMAX_GER MSMIN_GER) (setvar "clayer" clayer1) (setvar "INSUNITS" val_var_INSUNITS) (cmd-salir) (SETVAR "osmode" ref0) (setvar "3dosmode" 3DOSMODE_ORG) (setq *error* olderr) (command "_undo" "_end") (SETVAR "cmdecho" 1) (PRIN1) ) (defun entradaTest ( / ) (*push-error-using-command*) ;;(*push-error-using-stack*) (SETVAR "cmdecho" 0) (COMMAND "_undo" "_begin") (setq olderr *error* *error* myerror) (SETQ ref0 (GETVAR "osmode")) (SETVAR "osmode" 0) (setq 3DOSMODE_ORG (GETVAR "3dosmode")) (setvar "3dosmode" 0) (SETQ port_view_ger (getvar "cvport")) ;;(SETQ vpoint_ger (getvar "viewdir")) ;;(SETQ VSMAX_GER (getvar "vsmax")) ;;(SETQ VSMIN_GER (getvar "vsmin")) (setq val_var_INSUNITS (getvar "INSUNITS")) ;;(setvar "INSUNITS" 1) ;1 para pulgadas. (setq clayer1 (getvar "clayer")) (setvar "clayer" "0") (setq color_org (getvar "cecolor")) ) (defun salidaTest ( / ) (setvar "cecolor" color_org) ;;(setq *error* olderr) (setvar "cvport" port_view_ger) (command "_vpoint" vpoint_ger) (setvar "clayer" clayer1) (setvar "INSUNITS" val_var_INSUNITS) (SETVAR "osmode" ref0) (setvar "3dosmode" 3DOSMODE_ORG) (COMMAND "_undo" "_end") (setq *error* olderr) ; Restore old *error* handler (COMMAND "_undo" "_end") (SETVAR "cmdecho" 1) (*pop-error-mode*) (PRIN1) ) (defun AX-EXISTE+ (elemento coleccion / Colecciones temp X resultado *DrawingGER* Coleccion ) ;;Colecciones disponibles. (setq Colecciones (list "Blocks" "Dictionaries" "DimStyles" "FileDependencies" "Groups" "Layers" "Layouts" "LineTypes" "Materials" "ModelSpace" "PaperSpace" "PickFirstSelectionSet" "Plot" "PlotConfiguration" "Preferences" "RegisteredApplications" "SelectionSets" "SummaryInfo" "TextStyles" "UserCoordinatesSystems" "Utility" "Viewports" "Views") ) ;;Verifica si la coleccion existe en el documento actual. (setq temp nil) (foreach X Colecciones (if (equal (strcase coleccion) (strcase X)) (setq temp T)) ) (if temp (progn (setq *DrawingGER* (vla-get-ActiveDocument (vlax-get-acad-object))) ;;Obtiene el objeto DXF del dibujo actual. (setq Coleccion (vlax-get-property *DrawingGer* coleccion)) ;;Obtiene el objeto DXF de la Coleccion requerida, por ejemplo "Layers". (if (not (vl-catch-all-error-p (setq resultado (vl-catch-all-apply 'vla-item (list coleccion elemento))))) t nil) ) (progn (prompt (strcat "\n**(ax-Existe+) Nombre de coleccion \"" coleccion "\" no identificada.\n")) (princ) nil ) ) ) Any idea of the reason for the exception? Greetings.
  19. Dani_Nadir

    Automatic layout LISP

    Hello, I am interested in a LISP able to make overlapping sheets as layouts following a road alignment and overlap a fraction. Each sheet will have its own UCS or view orientation. You can see it from these videos: anyone knows one? Best regards, Daniel
  20. I am using AutoCAD VBA with array. I need to call a LISP function to pass a parameter (array). How can I the pass an array from VBA to LISP? I am using this expression: ThisDrawing.SendCommand "Myfunction"
  21. Hi. I have a lisp routine that I use all the time but I'm wondering if someone could please tell me how the routine sets the following variables: 1. The number of decimal places (precision) that the distance displays at. It currently displays it to 2 decimal places, I'd like to have 3 eg. 0.000 2. The text offset distance from the line. Thank you all in advance! (defun get_endpts (/ a b) (COMMAND "OSNAP" "ENDP") (setq a (getpoint "\nEnter first point: ")) (setq b (getpoint "\nEnter second point: ")) (COMMAND "OSNAP" "NONE") (list a b) ) (defun c:setdim () ;(initget (+ 1 2 4)) ;(setq scalefactor (getreal "\nEnter scale factor: ")) (if (not setmap) (load "setmap") ) (setmap) (setq scalefactor #mapsc) ;(initget 1 "Y y N n") ;(setq angflg (question "Do you want azimuths printed?")) (setq angflg "Y" angmessage "WILL") ;(cond (angflg ; (if (not (setq dimrotation (getangle "\nEnter angular rotation: "))) ; ;(setq dimrotation #mapang ) ; (setq DIMROTATION 0) ; ) ; (initget 1 "1 5") ; (setq secprec (atoi (getkword "\nRound off seconds to nearest <1 or 5> "))) ; ) ;) (setq dimrotation 0 secprec 5 secsmessage "5") (alert (strcat "DIMLINE SETTINGS: \n\nScale Factor set to: " (rtos scalefactor 2 6) "\nAzimuths " angmessage " print." "\nSeconds rounded off to " secsmessage "\"" "\n\n\nTo change the Scale Factor use MAP SETTINGS CSF \+ ROTATION \non the LISP pulldown.\n\nTo change other settings type SETDIM2.")) (setq dimset T) (princ) ;(chgsize (* (/ scalex 1000) 1.95)) );defun setdim (defun c:setdim2 () (initget (+ 1 2 4)) ;(setq scalefactor (getreal "\nEnter scale factor: ")) (if (not setmap) (load "setmap") ) (setq scalefactor #mapsc) (initget 1 "Y y N n") (setq angflg (question "Do you want azimuths printed?")) (if angflg (progn (setq DIMROTATION 0 angMessage "WILL") (initget 1 "1 5") (setq secsMessage (getkword "\nRound off seconds to nearest <1 or 5> ")) (setq secprec (atoi secsmessage)) ) (setq angMessage "WON'T" ) ) (alert (strcat "DIMLINE SETTINGS: \n\nScale Factor set to: " (rtos scalefactor 2 6) "\nAzimuths " angmessage " print." "\nSeconds rounded off to " secsmessage "\"" "\n\n\nTo change the Scale Factor use MAP SETTINGS CSF \+ ROTATION \non the LISP pulldown.")) (setq dimset T) ;(chgsize (* (/ scalex 1000) 1.95)) ) (defun c:dimline (/ L A B ucsflg) (load "F1") (cond ((not dimset) (c:setdim))) (if (/=(getvar "WORLDUCS") 1) (progn (command "UCS" "W") (setq UCSflg T) );progn );if (setq L (getline)) (dimfunc (getassoc 10 L) (getassoc 11 L) (placetxt (getassoc 10 L) (getassoc 11 L)) ) (if UCSflg (COMMAND "UCS" "P") ) ) (defun c:dimpts (/ ENDPTS ucsflg) (load "F1") (cond ((not dimset) (c:setdim))) (if (/=(getvar "WORLDUCS") 1) (progn (command "UCS" "W") (setq UCSflg T) );progn );if (dimfunc (car(setq ENDPTS(get_endpts))) (cadr ENDPTS) (placetxt (car ENDPTS)(cadr ENDPTS)) ) (if UCSflg (COMMAND "UCS" "P") ) ) (defun dimfunc (a b below / angab distab ctrpt d) (setq angab (angle a b)) (setq distab (distance a b)) (setq ctrpt (polar a angab (/ distab 2))) (setq d (/ distab scalefactor)) (cond (below (cond ((and (> angab (+ NORTH 0.1744)) (<= angab (+ SOUTH 0.1744))) (writedim d angab ctrpt (+ angab A90) (- angab PI) 1.20 2.85) ) (T (writedim d angab ctrpt (+ angab A270) angab 1.20 2.85)) ) ) (T (cond ((and (> angab (+ NORTH 0.1744)) (<= angab (+ SOUTH 0.1744))) (writedim d angab ctrpt (+ angab A270) (- angab PI) 1.20 2.85) ) (T (writedim d angab ctrpt (+ angab A90) angab 1.20 2.85)) ) ) ) ) (defun writedim (d azimuth ctrpt perpang orientation sp1 sp2 / textpt scalept) ;(switchl "DIMENSION") (setq textpt (polar ctrpt perpang (* (getxtht) sp1))) (setq scalePt ctrpt) (COMMAND "TEXT" "M" textpt (angtos orientation) (rtos d 2 2)) (cond (angflg (setq textpt (polar ctrpt perpang (* (getxtht) sp2))) (COMMAND "TEXT" "M" textpt (angtos orientation) (writeang (+ angab (dtr dimrotation))) ) )) (if (= (substr (getvar "CLAYER") 1 2) "34") (progn (findDetailScale) (if (and (/= nil detTxtScl)(/= 0.0 detTxtScl)) (command "SCALE" (lastn 2) "" scalept detTxtscl) (command "SCALE" (lastn 2) "" scalept theRatio) ) ) ) ; (switchl nil) ) (defun findDetailScale ( / detLayer detLen det7thLast undScr) (if (not c:lastn) (load "LASTN") ) (if (null theRatio) (progn (load "labelling") (c:detail) ) ) (setq detLayer (getvar "CLAYER")) (setq detlen (strlen detLayer)) (setq det7thLast (substr detLayer (- detLen 6))) (setq undScr (st_scan "_" det7thlast)) (setq detTxtScl (/ (* 0.001 (atoi (substr det7thLast (+ 1 undScr)))) plscale)) ) (defun writeang (azimuth) (setq azimuth (angtos azimuth 1 4)) (if (= "d" (substr azimuth 3 1)) (strcat (deg_format azimuth 3)) (if (= "d" (substr azimuth 4 1)) (strcat (deg_format azimuth 4)) (strcat (deg_format azimuth 2)) ) ) (cond ((= 5 secprec) (cond ((< 7 (last_digit seconds)) (setq seconds (additostr seconds (- 10 (last_digit seconds)))) ) ((< 2 (last_digit seconds)) (setq seconds (additostr seconds (- 5 (last_digit seconds)))) ) (T (setq seconds (additostr seconds (- 0 (last_digit seconds))))) ) (if (= (strlen seconds) 1) (setq seconds (strcat "0" seconds))) (if (= "60" seconds) (progn (setq seconds "00") (setq minutes (additostr minutes 1)) (if (= (strlen minutes) 1) (setq minutes (strcat "0" minutes))) (if (= "60" minutes) (progn (setq minutes "00") (setq degrees (additostr degrees 1)) )) )) )) (if (/= (strcase (getvar "LOGINNAME")) "Pam.hvizdos") (strcat degrees "%%d" minutes "'" seconds "\"") (strcat degrees "%%d" minutes "'" seconds "\"") ) ) (defun deg_format ( str pos) (setq degrees (substr str 1 (- pos 1))) (min_format (substr str (+ pos 1))) ) (defun min_format (str) (setq minutes (cond ((= "'" (substr str 2 1)) (sec_format (substr str 3)) (strcat"0" (substr str 1 1)) ) (T (sec_format (substr str 4)) (substr str 1 2) ) ) ) ) (defun sec_format (str) (setq seconds (substr (if ( = 2 (strlen str)) (strcat "0" str) str ) 1 2 )) ) (defun last_digit(str) (atoi (substr str (strlen str))) ) (defun additostr(str no) (itoa (+ (atoi str) no)) )
  22. I currently have a lisp routine to place a block at intersection points with one main line (RED) and then all other lines (WHITE) that cross it. I have a problem and cant seem to figure out how to adjust the code to make it work more fluid. I would like the main line to be able to be crossed more than once by a different line and still work. Currently if a RED line is crossed twice by any single white line it will not work and the lisp will bottom out and end (vl-load-com) (defun c:sbx ( / ) (progn (setq ent (car (entsel "\nSelect main line: "))) (if ent (progn (princ "\nSelect crossing line(s): ") (if (setq ss (ssget)) (progn (setq count 0 obj (vlax-ename->vla-object ent) pointlist nil ) (repeat (sslength ss) (setq xent (ssname ss count) xobj (vlax-ename->vla-object xent) ) (if (setq int (vla-IntersectWith obj xobj acExtendNone)) (progn (setq int (vlax-safearray->list (vlax-variant-value int)) pointlist (append pointlist (list int)) ) ) ) (setq count (1+ count)) ) (if (null (tblobjname "BLOCK" "SBblock")) (progn (entmake (list (cons 0 "BLOCK") (cons 2 "SBblock") (cons 70 0) (list 10 0.0 0.0 0.0))) (entmake '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (8 . "0") (100 . "AcDbPolyline") (90 . 2) (70 . 1) (43 . 1.0) (38 . 0.0) (39 . 0.0) (10 2.5 0.0) (40 . 1.0) (41 . 1.0) (42 . 1.0) (91 . 0) (10 -2.5 0.0) (40 . 1.0) (41 . 1.0) (42 . 1.0) (91 . 0) (210 0.0 0.0 1.0) ) ) (setq blockname (entmake '((0 . "ENDBLK")))) ) ) (foreach pt_nth pointlist (entmake (append '((0 . "INSERT") (100 . "AcDbEntity") (8 . "0") (100 . "AcDbBlockReference") (2 . "SBblock")) (list (cons 10 pt_nth)) '((41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0)) ) ) ) ) ) ) ) ) (princ) )
  23. Hi, First time poster so please take it easy..! I am having trouble getting my lisp to open a file, write to it then close again. I am using Lee Mac's 'LM:findfile' function. The variable 'dntxtloc' works when testing, returning a path "L:\\DESIGN\\2018\\2018-167 Commercial Road, MASLIN BEACH\\2018-167 Designer's Notes.txt" so I think the 'LM:findfile' function is working fine. It seems to fail after that, writing the 'write-line' to the command line instead and returning the error below... Command: Drawing Name is of an acceptable format20/05/2019 (Rosdun) - ; error: bad argument type: streamp nil Command: I was hoping someone might be able to help me as I'm sure it's something basic that I'm missing. Any help at all would be greatly appreciated. Snippet that seems to be the problem. (cond ( (setq dntxtloc (LM:findfile nnametxt sfpath)) ( (setq ff (open dntxtloc "a")) (write-line (strcat mydate " (" myusername ") - ") ff) (close ff) (startapp "C://Windows/Notepad.exe" dntxtloc) (princ) ) ) ( (setq dndocloc (LM:findfile nnamedoc sfpath )) ( (startapp "C://Program Files (x86)//Microsoft Office//root//Office16//WINWORD.exe" dndocloc ) (princ) ) ) (t ((alert "Designer's Notes not found...")(princ))) ); End Cond I will attach the full copy also. Regards, Ross. Open Designer's Notes V6.lsp
  24. I want to be able to import 5-10 different blocks that need to be placed at approximately 70 locations each. I want to achieve this by taking a CSV file I have with the following attributes: (NAME, Xcoord, Ycoord, Zcoord) and then place the 'NAME' block at the correct coordinates within the drawing. The blocks are already preloaded within the drawing itself so they can be referenced by name.
  25. I have two polygons. One is my corridor (see white), and my other are disturbances (see red). I'm looking for a lisp that creates polygons everywhere where there is an overlap between the two (see green hatch). I currently have a lisp that gives me the area of the intersecting hatch but it is only a single use. I want to be able to click the white boundary layer and then the red intersecting layer and have it make intersecting polygons between those two.
×
×
  • Create New...