Jump to content

Search the Community

Showing results for tags 'autolisp'.

  • 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. I have just started learning AutoLISP from different posts on the forums and through the reference material from Autodesk but, I am hitting an error in my lisp routine that I don't know how to fix. I am trying to right a while loop that will go through a nested list and use information in the selected list segment to find points in reference to a Polyline using the vlax-curve-* functions. Currently I am using the vlax-curve-getPointAtDist with a variable distance and using a user defined polyline from the document. My code runs up until the point I try to use the getPointAtDist line which will return the error of "unable to find ObjectID for . The way I get the polyline from the user is a (setq Var (ssget "_+.:s" '((0 . "*POLYLINE")))). I have earlier in the routine the vla-load-com to load in all of the functions of visual lisp. Can anyone help me out on what I need to do to be able to run the vlax-curve-* functions?
  2. Does anyone know a clean way to toggle a specified flip parameter using auto lisp visual lisp? I use the getdynprops, getdynpropvalue, putdynpropvalue [by Jeff Mishler based on code from Steve Doman, Herman Mayfarth and Tony Tanzillo] for most of my dynamic block changing needs but I can't get it they don't seem to work for the flip parameter.
  3. Thread: Boundary Creation Lisp- a request HI, I just learned how to create boundary smoothly from the above post. is there a way to create boundary by the coordinates of selected Texts? Thanks!
  4. Hello all you CAD Guru's out there! I am currently having trouble creating a lisp and am in desperate need of experienced guidance. I am trying to make a command such as (defun C:lo () (command "layer" "on" "*" "t" "*" "")) which turns all layers on, however i need the layers Circuit-1 through Circuit-12 to be untouched. For example if i have circuits 5 through 12 turned off, frozen, whatever state they may be in needs to not be affected by the command to turn all layers on. Basically I would like to make a command that turns all layers on with the exception of layers Circuit-1 through Circuit-12 I started to write a code based on layer groups which I though may be the way to accomplish this task. I.E. make a layer group of all layers EXCLUDING or removing Circuit 1-12 and thaw or turn on all of that layer group. I am unsuccessful in thawing the "new layer filter" using code. (I can however right click on the group and change its visibility to thawed and that works.) (defun c:TESTER (/) (COMMAND "-LAYER" "FILTER" "NEW" "GROUP" "" "*" "NEW LAYER FILTER" "") (COMMAND "-LAYER" "FILTER" "EDIT" "NEW LAYER FILTER" "DELETE" "CIRCUIT-1" "DELETE" "CIRCUIT-2" "DELETE" "CIRCUIT-3" "DELETE" "CIRCUIT-4" "DELETE" "CIRCUIT-5" "DELETE" "CIRCUIT-6" "DELETE" "CIRCUIT-7" "DELETE" "CIRCUIT-8" "DELETE" "CIRCUIT-9" "DELETE" "CIRCUIT-10" "DELETE" "CIRCUIT-11" "DELETE" "CIRCUIT-12" "") (command "-layer" "t" "new layer filter" "")) Where have I gone wrong?
  5. Hello, Im using AutoCAD, AutoCAD Mechanical 2009 and Mechanical Desktop 2009 I have parts that have a material assigned to them through the 'MASSPROPS' dialog box. When assigning the material to a part, material properties associated with that part are assigned as well. Is there a way to either remove the material assignment or create a "dummy" material with material property values set to 0 and assign this new material to the part using AutoLISP? If not AutoLISP, is it possible using any other code type?
  6. Hey guys, I am writting a routine to read a excel file that contains a column with the number of the element, a column with the x's coordinate and a column with the y's coordinate. I need a way of making a loop to read whatever elements are filled by the excel's user and get this values in vectors so they can be used after. Is there anyway of doing that? Thank you very much!
  7. Hello, Could anyone help me let this LISP work. The lisp should go to the layer you choose (by pressing 1 or 2) when in a *DIM* command. After placing the dimension the layer should go back to the layer it was before selecting a *DIM* command. This is the code now. ; AFKORTINGEN VAN DE VARIABELEN ; ADDL Automatic dimension layer ;**************************************************************************** (defun CommandReactor:Start () (or *CommandReactor* (setq *CommandReactor* (vlr-command-reactor nil '( (:vlr-commandcancelled . CommandReactor:CommandEnded) (:vlr-commandended . CommandReactor:CommandEnded) (:vlr-commandfailed . CommandReactor:CommandEnded) (:vlr-commandwillstart . CommandReactor:CommandWillStart) ) ) ) ) (prompt "\nCommand reactor loaded. ") (princ) ) ;**************************************************************************** (defun CommandReactor:CommandEnded (rea cmd) (if (and *OldClayer* (wcmatch (strcase (car cmd)) "*DIM*") ) (progn (setvar 'clayer *OldClayer*) (setq *OldClayer* nil) ) ) ) ;**************************************************************************** (defun CommandReactor:CommandWillStart (rea cmd) (if (wcmatch (strcase (car cmd)) "*DIM*") (progn (setq *OldClayer* (getvar 'clayer)) (vla-add (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) ; Kiezen van de DIM layer (setq ADDL 0) (while (or (< ADDL 1) (> ADDL 2)) (setq ADDL (getint "\nInput the DIM layer: Dim. (1), Dim. front (2): "))) ) ; end while ;ADDL = 1, Dimension layer (if (= ADDL 1) (progn (command "_layer" "_m" "S-DIMENSIONS" "_c" "3" "" "") ); progn ); if (=ADDL 1) ;ADDL = 2, Dimension front layer (if (= ADDL 2) (progn (command "_layer" "_m" "S-DIMENSIONS front" "_c" "3" "" "") ); progn ); if (=ADDL 2) (setvar 'clayer *OldClayer*) ) ) ) ;**************************************************************************** (CommandReactor:Start) (princ) ;**************************************************************************** ;**************************************************************************** ;**************************************************************************** ;**************************************************************************** Please help! Thanks!
  8. Hi all, I am using the attached lisp to import xyz (PNEZD) coordinates into Autocad 2015 with their points numbers and descriptions. The lisp works great, the only problem is that when all the points are put in, I can't change the colour and layer of the attached descriptions and elevations. The points themselves will change colour and layer, but we can't get the writing to move to those same layers. I'm not sure if this requires working on the lisp itself, or if it is something that can be fixed in a setting in Autocad, but I'm definitely stuck! Any help would be greatly appreciated. Thanks! pointsin-v1.0.13.zip
  9. I have thousands of sketches in autocad and need to calculate the weight for each sketch. The sketches are all in 2D format. The sketches are of shafts with different diameters and lengths. Each shaft has a major diameter and then a varying number of steps each with its own diameter and length. The dimensions of most of the sketches are associated to objects in the sketch; however, there are some sketches with non-associative dimensions. Is it possible to write an AutoLisp program to go through all of these sketches and pull the diameter & length of each shaft (including each diameter and length of each journal step) and then use the information to calculate volume and weight. Currently, I have an excel program that will calculate the weight if I type in all the length and diameter dimensions of the objects. The task is repetitive and time consuming. Writing a program may help expedite the task. Any advice would be helpful. Thanks
  10. ethangale25

    Automatic Drawing

    Hello All, This is my first post on CADTutor forum. This is a pretty extensive request, however I am looking to essentially do this exact routine: https://www.youtube.com/watch?v=FLOif87iLMw This automated process of creating the stepped boundaries to angled polylines based on the size of a panel, as well as automatically drawing panels into the drawn boundaries, etc, is everything that I need. Creating profile views, cross sections, etc. The question is, are there any AutoCAD commands that would expediate this programming or do I need to brute force this and essentially create a lisp routine from scratch? The more basic the steps, the easier I would be able to understand because I am relatively new to AutoCAD in general. In general where do I start? Thank you in advance for any help!
  11. I am trying to write an autolisp program to insert a row of 20 blocks in a drawing, (one over the other), then insert attributes for each from a row in an Excel file. I am using Jeffrey Sanders' "GetCells" function. The Excel file is "RO-16.xlsx" Here's what I have done so far: (defun Addenters ( / cnt yval) (setq cnt 1) (setq yval 0) (setvar "osmode" 0) (load "getcells.lsp") (while ( ( (setq *doc* (vla-get-activedocument (vlax-get-acad-object))) (command "insert" "C:\\07509\\BD" (strcat "0," (itoa yval))"1" "1" "04" (getCellsFunction "C:\\07509\\RO-16.xlsx" "ALLOCATED" "K2") ) (setq cnt (1+ cnt)) (setq yval (+ 8 yval)) ) ) ) So the first attribute, "PLC" is read from cell K2 in the Excel file. There are 7 attributes altogether. Is there a more compact way to do this (with a list or array). I want to avoid having a long line (which is answering to the Autocad prompt for block attributes) which looks like: (getCellsFunction "C:\\07509\\RO-16.xlsx" "ALLOCATED" "L2"), (getCellsFunction "C:\\07509\\RO-16.xlsx" "ALLOCATED" "M2") and so on.
  12. Dear smarties I read a few articles here and there regarding a way to generate multiple drawings from an excel file, but no one had explained step by step on how to do it. So, I am lost half way. I am very new to this kind of things, but I will try to follow, so please go slow on me. here is what I want to fix: 1. I need to automatically generate 10 drawings both in dwg and pdf copied into a folder. 2. All the variables (VAR1 to VAR3) are stored in an excel file. refer to the attached files as an example. 3. I only need to create one original drawing, which will be used to generate all the 10 drawings. Please help EXCEL-VAR.xls ORIGINAL-DWG.dwg
  13. I keep getting an error when I use getpoint. When I look at SPT or EPT it's nil (defun c:STUD15 (/ SPT EPT Wallth Ceilinghg) (setq SPT (getpoint "\nPick start of wall.....")) (setq EPT (getpoint "\nPick end of wall....."));at this point I get...error: bad argument type: 2D/3D point: nil (setq Wallth (distance spt ept));length of wall (setq Ceilinghgt 96.0) (setq UnflrBeamhgt (+ Ceilinghgt 0.5)); Can someone explain what I am doing wrong. Thanks
  14. I’m in the process of updating nearly 400 blocks. I have to change the layer and override the color of one attribute. My test on the first block failed. It's just been a while and I can't remember what I'm missing. My attempt for changing the first one: (progn (setq e (car (entsel )) d (entget e) n_e (entnext e) n_d (entget n_e))) un_d (subst (cons 8 "SYM") (assoc 8 n_d) n_d) un_d (append un_d (list un_d (cons 62 141))) ) (entmod un_d) (entupd (cdr (assoc 330 un_d))) ) I've also tried: (command "_.attsync" "_select" n_e "" )"_Yes") note: as I step through the block entities I will be testing to insure I've got the right block with: (and (= (cdr (assoc 0 n_d)) "ATTRIB") (= (cdr (assoc 2 n_d)) "SIZE") (/= (cdr (assoc 8 n_d)) "SYM") )
  15. Very usefull tool to transform 3D Faces To Solid ! ...or a 3D terrain model to a sectionable solid http://www.sharedengineering.com/index.php/13-download/autolisp/20-autolisp-to-transform-3d-faces-to-solid >>> http://www.sharedengineering.com
  16. I tested the code below by selecting one type of block, but instead of returning the name it returned *U36 (cdr (assoc 2 (entget (car (entsel "\nSelect a buble: ")))))
  17. Hello everybody! Few programmers (including myself) decided to create a website with free (for now) AutoLisp programs and scripts for Autocad. Well, we have few questions to define where to start. Your answers would really help. - Do you use programs (scripts) in your work? - Which program (script) you would use but do not have. Best regards, ... PS Link to website asap
  18. Hi all I really do not have much experience with AutoLISP but I would like to write a script that allows me to: 1. Create a new DWG 2. Draw a line from a set of existing coordinates from a .txt file 3. Save this drawing in a specified location 4. Close the drawing 5. Rinse and repeat until all of the .txt files have been drawn. Basically this will be used for hundreds of .txt files containing coordinates to draw the cross-sections of a tunnel. Is this something that can be done? As after hours of research I have only managed to be able to draw one cross-section using a batch file but haven't been able to close the drawing or save it. Thanks in advance for any help
  19. Hi, I am new to this forum, can anybody suggest a good autolisp tutorial for beginners??? thanks in advance
  20. Hello everyone, This is my first post on here so please forgive my ignorance if this is posted somewhere else. I am trying to create a lisp that will draw a polyline around a set of polylines, essentially connecting all start points and all endpoints. I just started writing lisps last week so I'm pretty new to this stuff, but the way I'm thinking about doing this is selecting all the polylines, filter out closed polylines that could be in the set, run a while loop to create a list of start points and end points, use repeat to draw a line from start point 1 to start point 2 to start point 3 etc. and then doing the same with the endpoints, and finally join all these lines into one polyline. Let me know what you all think. Thanks in advance.
  21. Hello everybuddies, I am new to lisp, so please for your advise. I want to pick an existing multi-segment polyline and use it as a selection fence (ssget "_F") As far as I understand I miss a simple piece of code that lists the points of the polyline in a way that ssget can accept them as a list of points to define the fence. (setq POLY (entsel "\n Pick a Fence Line crossing your beloved entities:")) ****POLY---->(please help!)----->POINTLIST**** (setq ss (ssget "_F" POINTLIST ) ) Thanx in advance
  22. I work as a boat designer and often require calculating total length of polyline & centre of gravity (both open & closed polylines). I have a snippet below to show the sample code I am currently using - this only works with a group of lines - it doesnt work with polylines. Currently everytime I have to calculate the CG, I have to copy the polyline over, explode it & select the lines to calculate the CG. The logic is as follows - assuming we have 3 segments on the polyline(A,B,C) : Centre of Gravity of Polyline = (Len of A multiplied by Centroid of A + Len of b multiplied by Centroid of B + Len of C multiplied by Centroid of C) divided by Total Length of polyline I am new to LISP & although have some background in other programming languages, find it is relatively difficult to write the code, the syntax being very different. I found a similar code ( TotalADD Total Addition by Andrea Andreetti & modified to come to the below code). It would be ideal if I can select a group of polylines (using select similar) and run the command to get a text table in autocad with CG & total length calculated for set of polylines on different layers. But I am not sure how this can be achieved. Would you be able to help or am I asking for too much ? any guidance will be much appreciated. (if (eq (vla-get-objectname n) "AcDbLine") (progn (setq itemlinelength (+ itemlinelength (vla-get-length n))) (setq StartPoint(vlax-safearray->list (vlax-variant-value (vla-get-startpoint n)))) (setq x1 (car Startpoint)) (setq y1 (cadr Startpoint)) (setq EndPoint(vlax-safearray->list (vlax-variant-value (vla-get-endpoint n)))) (setq x2 (car endpoint)) (setq y2 (cadr endpoint)) (setq xmid (* (+ x1 x2) 0.5)) (setq ymid (* (+ y1 y2) 0.5)) (setq xmom (* xmid (vla-get-length n))) (setq ymom (* ymid (vla-get-length n))) (setq itemxmoment (+ itemxmoment xmom)) (setq itemymoment (+ itemymoment ymom)) ) ) (setq totxcg (/ itemxmoment itemlinelength)) (setq totycg (/ itemymoment itemlinelength)) (setq tlength (rtos itemlength 2 ) (setq totxcg (rtos totxcg 2 ) (setq totycg (rtos totycg 2 ) (acet-ui-status (strcat "Length: " tlength "\n" "X CoG Pos: " totxcg "\n" "Y CoG Pos: " totycg "\n" )
  23. We have many geo-referenced raster images of a drawing map. Now we are manually inserting them in drawing where required. Is there any way that if we click anywhere in the drawing the image of that place should be insert.
  24. Keywordkid

    Run another

    Hi All, It's been some time since I have been using AutoCAD and all the lisp controls I learnt have disappeared from memory. I basically only using CAD as a tool for cleaning files to link into Revit and so have been setting up a routine to run through all the clean and purge utilities to speed this up and remove the repetitiveness of using the same sequence of commands over and over. One utility I'd like to add into my lisp is "Flatten.lsp" I have found how to run it but is there anyway I can pre-answer the prompts? i.e. Flatten All (Return) Yes? Thanks in advance. Mark
  25. subodh_gis

    Merge two polygons

    How can we merge two adjacent polygons or two adjacent closed polylines using lisp or any tool in autocadmap 2004.
×
×
  • Create New...