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 476 results

  1. Hello Everyone, I'm working on a GIS Application which is running with AutoCAD, in that we are placing some lines and structures, while placing that the annotation will be placced automatically middle point of that poly line. after that we need to align that as per the below image. is there any possible to align the blocks automatically. steps would be Select two Blocks--->Select the Line then the blocks should be alined automatically as per the below image. can anyone help me on this. Thanks in advance. Sample.dwg
  2. I have a drawing that has two different blocks (see attached), what I needed to do was transfer over the attributes of one block over to the other (both have different tags). For example copying over attributes in "rev0_date" from the first block tag over to "revslot1date" in the second block tag , I ran across some code in the forums that did just that created by Lee Mac.The problem with it is it only transfers one attribute over, I modified it a little but its still not exactly what I need. The way it currently works is - It asks me to choose the first block with the attributes to copy, once selected it then asks me to choose the second block that will have the attributes pasted to it, once I've selected them, it then pastes the first specified tag attribute in the first block to the second, after that I have to repeat the process again, clicking the block with the attribute to copy and then choosing the second block to paste, I have to keep repeating these steps, clicking the first block then the second over and over until all the tag attributes have been copied over. My question is how can I stop having click the first and then second block over and over again for each tag and instead only have to go through the process once (click first block, then second and then transfer all the attributes over at once). Here is my current code (sorry if its a mess I'm very new to this): (defun c:blockswap ( / _SelectBlockWithTag a b des src tag ) (vl-load-com) (setq DAT1A "Rev0_Date" ; Source Attribute Tag 1 DES1A "Rev0_Desc" ; Source Attribute Tag 2 REV1A "Rev0" ; Source Attribute Tag 3 RDB1A "Rev0_Drawn_By" ; Source Attribute Tag 4 REV1B "RevSlot1Number" ; Destination Attribute Tag 3 DES1B "RevSlot1Description" ; Destination Attribute Tag 2 DAT1B "RevSlot1Date" ; Destination Attribute Tag 1 RDB1B "RevSlot1DrawnBy" ; Destination Attribute Tag 4 ) (defun _SelectBlockWithTag ( tag / e a ) (setq tag (strcase tag)) (while (progn (setvar 'ERRNO 0) (setq f (car (entsel (strcat "\nSelect Block with attribute " tag ": ")))) (cond ( (= 7 (getvar 'ERRNO)) (princ "\nMissed, Try Again.") ) ( (not f) nil ) ( (and (eq "INSERT" (cdr (assoc 0 (entget f)))) (= 1 (cdr (assoc 66 (entget f)))) ) (if (not (setq z (vl-some (function (lambda ( x ) (if (eq tag (strcase (vla-get-tagstring x))) x) ) ) (vlax-invoke (vlax-ename->vla-object f) 'getattributes) ) ) ) (princ (strcat "\nBlock does not contain tag " tag ".")) ) ) ( (princ "\nInvalid Object Selected.") ) ) ) ) z ) (and (setq aa (_SelectBlockWithTag DAT1A)) (setq ab (_SelectBlockWithTag DAT1B)) ) (vla-put-textstring ab (vla-get-textstring aa)) (and (setq ba (_SelectBlockWithTag DES1A)) (setq bb (_SelectBlockWithTag DES1B)) ) (vla-put-textstring bb (vla-get-textstring ba)) (and (setq ca (_SelectBlockWithTag REV1A)) (setq cb (_SelectBlockWithTag REV1B)) ) (vla-put-textstring cb (vla-get-textstring ca)) (and (setq da (_SelectBlockWithTag RDB1A)) (setq db (_SelectBlockWithTag RDB1B)) ) (vla-put-textstring db (vla-get-textstring da)) (princ) ) drawing.dwg
  3. is there an easy way to call a variable value from another lisp - I googled this and there are varieties of answers that I do not understand. If it is possible, I would like to call variables azi, eebb and deee from this lisp into other lisps. When I set my true north to be say: 80 degrees, I would like to take this already set value on this lisp and create another lisp to do (- azi newvaliable) for example. Can someone help please? (defun c:azi () (setq temperr *error*) (setq *error* trap1) ; set Barricades width (if (not azi)(setq azi 0.00)) (setq eebb (getangle (strcat "\nTrue north Direction <" (angtos azi) ">:"))) (if (not eebb)(setq eebb azi)(setq azi eebb)) (setq deee (/ eebb 2)) (princ) ) ;defun
  4. So the problem im having is i have code that runs to show the offset of measured points to design points, unfortunately the code works by inserting one of 4 predefined blocks for NSEW, or one of 4 when in 2 directions; only showing orthogonal distances. These work by passing through the distance to the block tag, and then comparing the EW, and/or NS values to determine the correct arrow direction to insert the correct block. What i want is instead of using orthogonal distances, is to have an arrow block within these blocks, that changes the direction of the arrow, based on a bearing that you pass through. eg if the horizontal distance between 2 points is 25mm at a bearing of 45 degrees, then a tag is created as per normal with 25 and an arrow point 45 degrees. Any good ideas? I've looked in the forums and couldn't find anything to solve this. Attached is an image of what i have currently made, note the aligned one showing 130mm is kinda what i want, but that arrow is not dynamic, it just goes left or right and the whole block is just rotated to show the bearing. It makes for a messy plan and a lot of neck craning to present to a client
  5. This post is very similar to what I intended with rotating blocks by first determining True North and then new azimuth from true north (I succeeded in doing that one no perfectly but it does most of what I wanted). I did try, in the past to obtain some dxf entities from blocks but am clueless when I look at the result. I would like to see, in each drawing file: set an arrow block to North then with a magical lisp each time I enter the command I would like the an insert of the block with inputting new degree from the North to be inserted. and to top it off, if there is a way for the degree to show up on the #### that would be excellent. I also cannot figure out an efficient way to flip the text so it always shows the text correctly but that is another problem. Is there anyone that can cook something up for me please? in the past, BIGAL had helped me a lot in determining my block rotation but this seems it has a lot of DXF entity I cannot figure out! I played around with this lisp but cannot do much! (vl-load-com) (defun c:IR ( / centro angR Fr obj) (setq centro (getpoint "\nSelect Block Insertion Point : ") angD (getreal "\nEnter Rotation Angle for Block in Degrees : ") Fr (getstring "\nEnter Force applied : ") angR (* pi (/ angD 180.0)) );end_setq (command "_-insert" "r" "_s" "1" centro (angtos angR) Fr (strcat (angtos angR) "%%d")) (setq obj (vlax-ename->vla-object (entlast))) (if (< (/ pi 2) angR (* (/ pi 2) 3)) (foreach prop (vlax-invoke obj 'getdynamicblockproperties) (if (= (strcase (vla-get-propertyname prop)) "????") (vla-put-value prop (vlax-make-variant 180.0 (vlax-variant-type (vla-get-value prop)))) );end_if );end_foreach );end_if (princ) );end_defun (princ) Thank you Arrows.dwg
  6. Hey all, I have a block (attached) that I'd like to insert into a drawing and after it's placed I'd like to populate the "PointNo" and "Descr" attributes with some user inputted data. I honestly have no idea where to start and appreciate any and all starting tips or help. Thanks, JT COORD ID.dwg
  7. Hello, i want to ask if it possible to create lisp who can change coordinates on multiple polyline. Something like, few polylines with coordinates (№ X Y) 1 100 200 2 200 250 3 300 210 4 150 220 5 110 250 and i want to export in .txt file all of the lines and their coordinates and change them, after the change i want to replace this coordinate(№ 1,2,3,4,5) with the new. Something like export-->change-->and replace Same line but with other coordinate. Sorry for my english. Thak you
  8. Hi Guys, I have an AutoLISP that creates an Excel sheet from selected table in an AutoCAD Drawing. It exports tables formed by lines and texts, also recognizing what should be merged cells. It opens a new Excel spreadsheet and fill the respective cells. Works like a charm for the job I need to do. However, It does have a flaw. It doesn't saves the generated sheet. I have to do it manually. Can you guys please help-me to complete this LISP? I Have zero programming knowledge. What I'd like it to do is to save the generated spreadsheet in the same folder as the autocad file, with the same name as the autocad file. Lilke DWG001.DWG would save a spreadsheet called DWG001.xls I'll attach my current AutoLISP file. Thanks in advance, guys. TE_TableExport_Exporta tabelas com linhas e textos para Excel.lsp
  9. I would like to modify this lisp script so that the dimension has a centered text instead of on a side of the dimension. But i don't know how. (defun c:HD (/ HD_LineHouse HD_LineProperty HD_Point1 HD_BasePoint1 HD_Text1 HD_Point2 HD_BasePoint2 HD_Text2 HD_ActiveDoc HD_ActiveSpace) (if (and (setq HD_LineHouse (car (entsel "\nSelect house line : "))) (setq HD_LineProperty (car (entsel "\nSelect property boundary: "))) (= (vla-get-ObjectName (setq HD_LineHouse (vlax-ename->vla-object HD_LineHouse))) "AcDbLine") ) (progn (setq HD_LineProperty (vlax-ename->vla-object HD_LineProperty)) (if (not (vl-catch-all-error-p (setq HD_Point1 (vl-catch-all-apply 'vlax-curve-getClosestPointTo (list HD_LineProperty (setq HD_BasePoint1 (vlax-safearray->list (vlax-variant-value (vla-get-StartPoint HD_LineHouse))))))))) (progn (setq HD_Point2 (vlax-curve-getClosestPointTo HD_LineProperty (setq HD_BasePoint2 (vlax-safearray->list (vlax-variant-value (vla-get-EndPoint HD_LineHouse)))))) (setq HD_Text1 (polar HD_Point1 (angle HD_BasePoint1 HD_Point1) 0)) (setq HD_Text2 (polar HD_Point2 (angle HD_BasePoint2 HD_Point2) 0)) (vla-StartUndoMark (setq HD_ActiveDoc (vla-get-ActiveDocument (vlax-get-acad-object)))) (vla-put-TextPosition (vla-AddDimAligned (setq HD_ActiveSpace (vla-get-Block (vla-get-ActiveLayout HD_ActiveDoc))) (vlax-3d-point HD_BasePoint1) (vlax-3d-point HD_Point1) (vlax-3d-point HD_Point1)) (vlax-3d-point HD_Text1)) (vla-put-TextPosition (vla-AddDimAligned HD_ActiveSpace (vlax-3d-point HD_BasePoint2) (vlax-3d-point HD_Point2) (vlax-3d-point HD_Point2)) (vlax-3d-point HD_Text2)) (vla-EndUndoMark HD_ActiveDoc) (mapcar 'vlax-release-object (list HD_ActiveSpace HD_ActiveDoc)) ) ) ) ) (princ) ) HD-Automatic Dimension.LSP
  10. 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.
  11. 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.
  12. 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
  13. 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!
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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!!
  20. 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.
  21. Hi All Members Please Please help me for text on Polyline with block Sorry for English S2_A1_CS_LIST_FINAL.dwg
  22. 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.
  23. 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..!!
  24. 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) )
  25. 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.
×
×
  • Create New...