Jump to content

Search the Community

Showing results for tags 'lisp'.

  • 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...

  1. Hi, I need a small lisp that opens and closes a file for me in the background. Nothing needs to be done. In this lisp the file is opened but not closed. (defun c:open_close_explorer () (setq Path "Y:\\Folder\\Data\\Test.txt") (setq File (StartAPP "Explorer.Exe" Path)) (close File) (princ) ) Does anyone have an idea?
  2. Hi, I'm trying to query the variable "Weight" and if it has the content "50" I want to define a new variable: "Stamp" with the content "internal". Is WCMATCH the right command for this? (if (= wcmatch Weight "50") (progn (setq stamp "intern"))) (princ)
  3. Hi, I'm working on a LISP that in part needs to grab the filename (without extension) for a command - I managed to do this using 'vl-filename-base' but since it needs to run in acoreconsole it can't use anything from the VL Library. Is there any way to either remove ".dwg" or remove the last 4 characters from a string in only vanilla LISP? Here's what I've got so far (defun C:PlotToLocation (/ filename) (vl-load-com) (setvar "cmdecho" 0) (setq filename (vl-filename-base (getvar 'dwgname))) (setq filename (strcat "A:\\X\\Y\\" (vl-filename-base (getvar 'dwgname))".pdf")) This sets the filename to "A:\X\Y\filename.pdf" I can currently get "A:\X\Y\filename.dwg.pdf" but since the PDFs have to follow a naming standard, I need a way to remove the ".dwg".
  4. Hello Community! I have been researching this for some time, I am trying to know if it is possible through a routine (lisp) to transfer / copy the information from LT (link template associated with a database in access) to the OD (object data) as I show in the image. So i need a very specific Lisp/VLisp/VBA/Dotnet routine who asks for : -- The Link Template DB name -- Which DB fields are you interested for -- Which OD Table MAP to fill -- Which OD Fields MAP to create or to use (if already existing) -- Selecting objects -- Retain only objects which the correct parameters -- ACTION ... Copy Data to OD fields ... append DWG & MDB files as example. thanks for the help you can give me, greetings EJEMPLO.zip
  5. Hi all, is it possible to read attributes or properties from the _DWGPROPS and list them in a Lisp e.g. as variables? I need the yellow marked attribute (OD2485), which always has a different number. (defun c:dropsforatts () (setq (vla-get-ActiveDocument (vlax-get-acad-object)) (vla-get-SummaryInfo doc) ) (setq i 0) (setq i 5) ) I would then like to insert this variable into a file path in a Lisp. (defun c:tempsave () (getvar "DWGNAME") (getvar "DWGPREFIX") (command "_+saveas" "G" "2018dwg" "2018(LT2018)" ("F:\\\\Clients\\CT2485\\OD2485\\Planning" ;i need the OD2485 as a variabel from the DWGPROPS (strcat (substr (getvar "DWGNAME") 1 8) "_temp") ) ) )
  6. Hi Guys, I have several layouts when drawing, which also have different names. I want to save in a Lisp all layouts that start with a specific name in a certain folder as PDF. I am new in lisp, but i have managed to write a lisp that selects the correct location for me. Unfortunately only all layouts are printed. (defun c:Dokument_Export () (command "-EXPORT" "PDF" "ALLE" (strcat (substr (getvar "DWGPREFIX") 1 70) "\\08_Auftragsbestätigung\\" (strcat (substr (getvar "DWGNAME") 1 8) "_Zeichnung") ) ) ) You have any idea? Thanks in advance.
  7. I came across the attached LISP routine that allows attribute information to be extracted into an excel document. Unfortunately this code searches the entire drawing for attributes, when I need only specific blocks to be selected. I am looking to modify the following code, so that it will prompt me for a selection window when extracting specific block attributes in a drawing. If anyone can help me with this I would appreciate, as I have no experience writing or modifying LISP. Thank You ATTOUT.LSP
  8. need help from senior here, as my attachment file from cad to output excel table, i need to create report ( coordinate and area ) from all closed polyline has text as an ID thanks in advance AREA.dwg REPORT.xlsx
  9. Hello i have some problem with intersect point. I will upload dwg file. I dont know why when i try to get all intersect point from the red something go very wrong. I need all intersect point from the red lines. Thank you Try_5.dwg
  10. Hello, I'm searching to make a LISP, to change the layer of an attribute. Actually it in "TopoAlt" Layer, I like to change in "0" layer (or other) I thinked about DXF code but i don't find it with dumpallproperties. "Battman" command would be a good solution but I can't make script "-eattedit" command is pretty close but I'm stopped when It need " attribute selection". If i could scripting "-eattedit" with an automatic attribute selection (like an already made SSGET), I could change the layer, or other properties ! Any Idea ?
  11. The task is simple. I have a drawing containing various blocks and a folder containing those blocks that separate in each dwg file . I want to make an auto routine: list all blocks contained in opening dwg > searching them in the library folder > redefine all blocks that containing in the list from the library folder. Please help me, because I couldnt find any existing lisps that be able to solve this problem
  12. Hello! I have been getting suggestions and help from this forum for some time now, but have reached a point where I am currently at a loss. I am still relatively new to the topic of lisp and co, but I am trying to improve constantly. For my current problem, I am trying to select a block and insert a point into it. I have simplified my current lisp file into the function below so as not to go over the top. My problem is that I get back an empty selection set and thus can't execute the function from Lee Mac correctly. (defun TestFunction ( / ) (while (= ss NIL) (if (setq ss (ssget "_+.:S:E:L" '((0 . "INSERT")))) (progn (setq ent (ssname ss 0)) (setq Block (vla-item (vla-get-blocks (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))) (cdr (assoc 2 (entget (ssname ss 0)))))) (Insert_Point) ) ) ) ) (defun Insert_Point ( / ) ;; Block Einfügepunkt ermitteln (setq Message (strcat "\nEinfügepunkt wählen:")) (setq Pnt (getpoint Message)) (setq sel (ssadd)) (setq Point (vla-addpoint Block (vlax-3d-point Pnt))) (ssAdd (vlax-vla-object->ename Point) sel) ;; sel stays empty so the following line cant be executed properly (UpdateBlock doc ent sel) ) Many thanks for your help! Best regards Florian
  13. I want to create a polyline with pl command between points from 2 different layers. Sorry for the low-quality photo. Is there an easy way to create a LISP bc there are thousands of points I need to do manually? Any help would be appreciated.
  14. Dear Members! Problem part I I now turn to you with the question of how to extract certain data from the "_massprop" command and assign it to a variable immediately. I am working on an automation task where a cable cross section has to be pulled out on a given 3D polilyne path. I need to extract the volume of the resulting 3D solid to calculate the volume of the displaced top. Problem part II Similarly, I should extract the length of the extracted 3D tube from the property table. This data is available if I extract the cross section with the _extrude / path command. I have to assign the extracted data to a variable within the lisp program to perform a mathematical operation on it. As follows: (setq V (volume data from the _massprop command)) (setq Vm (/ V (1000 ^ 3)); converting the mm3 to m3 Problem part III I would like to write the obtained result in a table in the model space. Column 1: "Volume of ground displaced by the pipeline" Colum 2: "The result of the calculation (which will be the value of a variable Vm)" Here is my code for calculation the cross section of the cable and to extrude it. The polyline must to be placet at '(0 0 0) All help comes in handy: (defun c:kabel(/ K_A K_AKEM K_DKE K_DKEM K_H K_L K_PT0 K_PT1 K_PT2 K_PT3 K_PT4 K_PT5 K_RKE K_RKEM K_RTOT K_SS1 K_V PIR) (setq K_Dke (getreal "Adja meg a kábel ér külső átmérőjét:")); Give me the diameter of the subcable (setq K_Akem (getreal "Adja meg a kábel ér magjának keresztmetszet területét (mm2)-ben) :")); Give me the copper cross section area (setq K_L (getreal "Adja meg a beillesztett polilyne teljes hossszát m-ben:")); Give me the length of the cable route (setq pir 3.141592654) (setq K_Dkem (sqrt (/ (* K_Akem 4) pir))); The copper diameter (setq K_Rke (/ K_Dke 2)) (setq K_Rkem (/ K_Dkem 2)) (setq K_pt0 '(0 0 0)) ; The low right cable part (you have 3 of them) (setq K_pt1 (polar K_pt0 (* pi 0.666666666666) K_Dke )); The center position of the upper cable part (setq K_pt2 (polar K_pt0 pi K_Dke)); The center of the third cable part ( part 3 of 3) (setq K_h (* K_Dke (sin (/ pi 3)))) (setq K_pt3 (polar K_pt2 0 (/ K_Dke 2))) (setq K_pt4 (polar K_pt3 (/ pi 2) (* K_h 0.333333333333)));The outer circle center point calculated from 3 cabel parts which are 120 degree from each other, like a mercedes logo (setq K_Rtot (+ K_Rke (* K_h 0.666666666666666))); Radius of the cable pipe (setq K_pt5 (polar K_pt4 (/ pi 2) K_Rtot)) (command "_circle" K_pt4 K_Rtot "") (setq K_ss1 (ssget "_L")) (command "_extrude" "_Mode" "_solid" K_ss1 "" "_path" '(0 0 -0.1) "") (setq K_A (* (* (/ K_Rtot 1000) (/ K_Rtot 1000)) pir)) (setq K_V (* K_A K_L)) (alert (strcat "The volume of the cable=" (rtos K_V) "m3")) (princ) )
  15. JoanM

    Newbie

    Hi, I'm trying to get the element count of each path array in a drawing that has a lot of them and export these values to a file. First I tried to do it through data extraction, but aparently the data extraction wizard doesn't allow to extract data from path arrays (or I have not been able to do so). So I turned to a lisp based solution. However I can't figure out how to get it. I expected to see that parameter (number of elements in a path array) as an entity code, but none of these looks like the object count of the path array nor path length or element spacing (which would allow to calculate the element count). I attach an example of the codes I get for a path array having 28 elements (path length 340,2 and element spacing 12,6): ( (-1 . <Entity name: 28777fee5f0>) (0 . "INSERT") (5 . "3362F") (102 . "{ACAD_REACTORS") (330 . <Entity name: 287073a1d50>) (102 . "}") (330 . <Entity name: 287774819f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "HOLES_LAYER") (100 . "AcDbBlockReference") (2 . "*U110") (10 0.0 10000.0 0.0) (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) ) I appreciate any help.
  16. Hello, i have problem with creating region. In my case i try to create grid region i have 4 polygons and when i select all lines from 3 of them it work perfect but when i try in last polygon something go wrong. Upload file. Thank you and Happy Holidays. TRYYY_XX.dwg
  17. Hi everybody, I am converting some excel formulas to Visual Lisp. I found a difference between results of a same follwing formula: (I changed cells to numbers to simplify the problem.) in Excel: =0.6*2400*1.15*1170*1.1/100000 ---> result: 21.31272 In AutoLISP: (/(* 0.6 2400.0 1.15 1170.0 1.1) 100000.0) ---> result: 21.3127 While AutoLISP isn't as correct as Excel. Any help to get a result like Excel is appreciated.
  18. Hello everyone, sorry if my question is stupid but i dont understands how it work. I want to ask after "(vlax-dump-object obj T)" and find all methods. ; Methods supported: ; AddPointMultiple (1) ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; CreateSnapshot () ; Delete () ; ExtractBorder (1) ; ExtractContour (4) ; FindElevationAtXY (2) ; GetBoundingBox (2) .................................... others. In my case i dump Tin surface. Question is how can i use them, i found for this (setq contours (vlax-invoke-method obj 'FindElevationAtXY X Y)) (setq something (vlax-invoke-method obj 'ExtractContour ? ? ? ?)) if i understand right i need 4 parameters but dont know where to find them. Where or how i can see for each method what is the parameter. My goal is to extract grid lines from surfaces. Thank you
  19. Hello, i want to ask for help with creating closed polygon from Grid lines with lisp. Regards Trudy
  20. (defun KGA_BlockClassic_EffectiveName (blk / elst blkRecHnd) (setq elst (entget (if (= 'ename (type blk)) blk (tblobjname "block" blk))) ) (if (and (= "*" (substr (cdr (assoc 2 elst)) 1 1)) (setq blkRecHnd (cdr (assoc 1005 (cdadr (assoc -3 (entget (cdr (assoc 330 elst)) '("AcDbBlockRepBTag"))))))) ) (cdr (assoc 2 (entget (handent blkRecHnd)))) (cdr (assoc 2 elst)) ) ) (defun ChangeDynBlockLayer (nme layDef / N_Mod blks i nmeLst) (defun N_Mod (blk) (vlax-for obj blk (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (not (vl-position (strcase (vla-get-effectivename obj)) nmeLst)) ) (setq nmeLst (append nmeLst (list (strcase (vla-get-effectivename obj))))) ;(vla-put-color obj col) (vla-put-layer obj layDef) ) ) ) (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) (setq nmeLst (list (strcase (KGA_BlockClassic_EffectiveName nme)))) (setq i 0) (while (< i (length nmeLst)) (setq nme (nth i nmeLst)) (vlax-for blk blks (if (= nme (strcase (KGA_BlockClassic_EffectiveName (vla-get-name blk)))) (N_Mod blk) ) ) (setq i (1+ i)) ) ) (defun c:DefC ( / layDef doc enm obj) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (and (setq enm (car (entsel ))) (setq obj (vlax-ename->vla-object enm)) (= "AcDbBlockReference" (vla-get-objectname obj)) (setq layDef "Defpoints") ) (progn (ChangeDynBlockLayer (vla-get-name obj) layDef) (vla-regen doc acactiveviewport) ) ) (vla-endundomark doc) (princ) ) I am having an issue here, hope someone could help: (ssget '((-4 . "<or") (8 . "Defpoints") (62 . 30) (-4 . "or>") )) What I am trying to do is this routine to select one or however many objects to then : if any entities in dynamic blocks are in colour 30 to put them under layer "Defpoints" and leave the colour as is (Since Defpoints has a different colour under Layer Properties Manager) so I do not want to make anything ByLayer. In short > Change the layer to "Defpoints" on all entities that are colour 30 I would also appreciate if there is a selection option: either select objects one by one or Window selection. Also I was not sure how to include simple line, arc, pline, etc... if the objects are not blocks, dynamic or nested blocks - example once I am inside the block editor or if no block is made and I would like to be able to have the routine does the same! Thanks
  21. Dears, May anyone help me in modifying the lisp attached... the lisp attached deduce the invert level based on 01- Pipe Start Elevation 02- Pipe Slope 03- Flow direction and the final result is as shown on the image shown below What I need is to put the absolute elevation on the form "IL.0.0000MM" & add another two text captions the relative elevation"IL.-0.0000FFL" & Pipe type and size"(WP/SP/RWP0000MM" the inputs are 1- FFl Reference Level where "IL.-0.0000FFL" will be a result of [ absolute level - relative level ] 2- Pipe type is SP or WP or RWP & 50/75/110/160/ or 200 MM The result I need as an example is in the below shot: Please help me. thanks in advance SD.LSP
  22. 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
  23. Hello. I was wondering if this is even possible to do with LISP. So this is what I need - I need a Lisp that would create cross section for ditch. I would like to type in existing ground and ditch marks, then existing width of the ditch and existing bottom width of the ditch. After that I would like to create a designed ditch cross section, by entering the same parameters + slope must be 1 : 1.5. (Also, both, existing and designed ditch bottom centers must align.) For background I would need frame that You can see in added file. For me all this sounds unreal, but if there is someone that can produce something like this I would be really thankful. x section.dwg
  24. Hello everyone, The attached code that "Replace the text by block and transfer the value to the attribute" and the code is working. What I intend to do now and am not succeeding in doing is the following : 1) I noticed that, the block insertion point is being at the coordinate (Geometry --> Position X of variable T2B_Text). Is it possible to insert the block at the coordinate ( Text --> Text alignment X of variable T2B_Text)? (See image 1) 2) Is there any way to make sure that the total value of the variable "T2B_AttributeTag" is not all transferred to the block attribute? (See image 2) Example: T2B_AttributeTag = TO 1301-UZY-1826A Value of Block attribute (T2B_Block) = 1301-UZY-1826A (Accurate this way) Obs : The Txt file is by (DannyNL), taken from the AutoCad forum. Code Lisp.txt
  25. Hello, I have a lot of drawings comming from an export f.e. Tekla stuctures. Those drawings have no layer structure, only thing to categorize entities are the colors. Is it possible to create layers per color and get the entities in that layer? Thanks in advance 1A - Fundering.dwg
×
×
  • Create New...