Jump to content

Search the Community

Showing results for tags 'code'.

  • 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 22 results

  1. Hello guys, I am working in AutoCAD. I am looking for a combined LISP code for creating points for the selected objects at its Endpoints, Midpoints, Center, Geometric center, Node, Quadrant, Intersection & Insertion as per users requirements (options with drop down list mentioning Endpoints, Midpoints, Center, Geometric center, Node, Quadrant, Intersection & Insertion Shall get prompted.) Once I select the required snap then the result shall be creation of points at the chosen object snap. An imaginary Example shall be Like like this, command: POBS(Points at Object Snap)-->prompting for what snap need to be found in the selected objects in the for of drop down list--> Creating points in the selected Object Snaps of the selection set. Actually i had found few LISP codes for the following cases 1.PLE-Points on Line Ends.lsp 2.PAI-Point At Intersection.lsp Thanks for the authors of these above LISP they have saved lot of time till date. Thanks in advance.
  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. Hello, My manager made this LSP file for me and it doesn't work and we are both not sure why. Seems correct to me. How it works: Creates the E-Anno-Note layer, otherwise makes it current, then creates an MLeader (to avoid creating leaders on incorrect layers). (DEFUN C:NN () (setvar "cmdecho" 0) (if (not (tblsearch "layer" "E-Anno-Note")) (command "-layer" "n" "E-Anno-Note" "c" "2" "E-Anno-Note" "")) (command "-layer" "m" "E-Anno-Note") (COMMAND "mleader") (princ) ) Thanks!
  4. Is there a more efficient way to write the following code? Thanks in advance for any suggestions. (mapcar (function (lambda (l) (vl-catch-all-apply 'vla-addline l)) ) (list (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(0.5 1.0 0.0)) (vlax-3d-point '(8.0 1.0 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point '(8.5 0.0 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(0.0 11.0 0.0)) (vlax-3d-point '(0.0 0.0 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(0.5 10.5 0.0)) (vlax-3d-point '(0.5 1.0 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(8.0 1.0 0.0)) (vlax-3d-point '(8.0 10.5 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(8.5 0.0 0.0)) (vlax-3d-point '(8.5 11.0 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(0.5 10.5 0.0)) (vlax-3d-point '(8.0 10.5 0.0)) ) (list (vla-get-paperspace (acdoc)) (vlax-3d-point '(0.0 11.0 0.0)) (vlax-3d-point '(8.5 11.0 0.0)) ) ) )
  5. Hi, i'm want to import the code (or description) from csv file (X,Y,Code) on the coordinates of each point. I can do it in excel, but i'm looking for a easy way. The layer could be current, height 2, and rotation 0. I can change this properties later, so no problem about it. Please excuse my limited English, corrections are welcome. Many thanks in advance.
  6. Hi, I searched and found some code on here that did not go as deep as I need it to. A few weeks ago I made a multileader with the hexagon and enabled the large dot on the end of the leader, it was MLS "STANDARD", my first mistake. But 1st, I customized the _TagHexagon so it had a masked mtext attribute. At the time I didn't know that Quick Select and Object Selection Filters did not differentiate between home made mleaders and mleaders with mtext and a simple leader. The reason I need to separate them, sometimes I come into a dwg and all the MLs are linespace factor of 1, I want to grab them all with a filer and make them .9, looks so much better, but it also grabs my custom MLs because I left the style name as STANDARD, once they are all selected, the properties fields will not show the "line space factor" field so I have to pick each mleader, and there are a lot of them! There's nothing else unique to filter, all on layer TEXT, BYLAYER, etc. Has anyone written code to select STANDARD AND Hexagon? Or STANDARD AND MLs with leaders with dots, OR filled arrow heads etc? I am not great at lisp but I can tweak it, insert names of my own styles, blocks etc. In the mean time, I will make my new custom MLs with Color White or put the 1st one in the dwg on a different layer but I have made 30 dwgs full of these mixed MLs. Thanks much if you can help! BTW, I'm using Acad 2014 -=(RLH)=-
  7. Morning All, Is the a lisp or some code to delete a hatch from every block in a drawing. The super market chain I'm working with use the same blocks over and over on different projects but there is a hatch on most of the blocks which interferes with my phasing drawings. I've tried Freezing/Turning Off the layer but as they have not set the blocks up with layer intelligence that doesn't work. I'm not worried about loosing the information contained within there blocks as I'm working for the builder producing CAD files that are only issued in PDF format. I don't want to explode the blocks! Look forward to your comments
  8. Hi, I am working in Fabrication and am trying to make a lisp that will select all items of a certain cid# (4 and 61) and then run a ctext on them. The lisp is also supposed to run a script at the same time, but that part works fine. This is my code so far... (defun c:etag() (setq ss (ssget)) (setvar "pickfirst" 1) (sssetfirst nil ss) (executescript "Elbow Tagger.cod") if item.cid = 4, 61 then (addctext "AMCI-Full-Elbow-Tag") end if end select) Currently, this lisp will apply the ctext to very part selected. I am only familiar with VB so I was a little lost when trying to tell the lisp to select cid#
  9. Hello, I am trying to get a LISP reactor to work whist a function is running. So my scenario is, is that I have I have a function that draws certain things in AutoCAD. While this function is running, I want to have my reactor activated, so it sets things and when the function is cancelled, the reactor will revert everything back to the way it was before I used the function in the command line. Right now, I have the function that draws stuff and a command Reactor. Can someone point me to the right direction on how to get the reactor to activate inside the function?
  10. When I generate a new drawing it creates a text file with information. Autocad updates text automatically from this file using specific layers that the string is on in the drawing. Depending on what layer a string is on, that will determine what information it is updated with. With that being said, it will not update ATTRIBUTES within a BLOCK. Can someone help. I am willing to discuss and assist with figuring this out. I will be automating some information for my titleblocks and ALL of our titleblocks are blocked with attributes. Here is the code used to update the info (defun uinfo () (princ "\nUpdating Drawing Information...") (if (= found 1) (progn (setq dummy (read-line infile)) (setq desc (read dummy)) (setq dummy (read-line infile)) (setq drawing (read dummy))) (progn (setq desc '(1 . "- NEW EQUIPMENT -")) (setq drawing '(1 . "- UNASSIGNED -")))) (setq sset (ssget "X" (list (cons 0 "TEXT") (cons 8 "TITLE")))) (setq lp 0) (while (< lp (sslength sset)) (setq ent (entget (ssname sset lp))) (setq entinfo (cdr (assoc 1 ent))) (if (= (substr entinfo 1 4) "Desc") (entmod (subst desc (assoc 1 ent) ent))) (if (= (substr entinfo 1 4) "Draw") (entmod (subst drawing (assoc 1 ent) ent))) (if (= (substr entinfo 1 3) "Dwg") (entmod (subst drawing (assoc 1 ent) ent))) (if (= (substr entinfo 1 4) "DESC") (entmod (subst desc (assoc 1 ent) ent))) (if (= (substr entinfo 1 4) "DRAW") (entmod (subst drawing (assoc 1 ent) ent))) (if (= (substr entinfo 1 3) "DWG") (entmod (subst drawing (assoc 1 ent) ent))) (setq lp (1+ lp))) (setq sset nil) (setq lp nil) (setq sset (ssget "X" (list (cons 0 "TEXT") (cons 8 (strcat tcircuit "-EQMRK"))))) (setq lp 0) (if (/= sset nil) (while (< lp (sslength sset)) (setq ent (entget (ssname sset lp))) (setq entinfo (cdr (assoc 1 ent))) (if (= (substr entinfo 1 4) "Desc") (entmod (subst desc (assoc 1 ent) ent))) (if (= (substr entinfo 1 4) "Draw") (entmod (subst drawing (assoc 1 ent) ent))) (if (= (substr entinfo 1 3) "Dwg") (entmod (subst drawing (assoc 1 ent) ent))) (if (= (substr entinfo 1 4) "DESC") (entmod (subst desc (assoc 1 ent) ent))) (if (= (substr entinfo 1 4) "DRAW") (entmod (subst drawing (assoc 1 ent) ent))) (if (= (substr entinfo 1 3) "DWG") (entmod (subst drawing (assoc 1 ent) ent))) (setq lp (1+ lp)))) (princ "Done.") (prin1)) Here is the actual routine used to provoke the update of all information in the drawing based on its respective layer. (defun C:UPDATE () (setvar "CMDECHO" 0) (setvar "MENUCTL" 0) ;; (command "._snap" "0.03125") (command "plinewid" "0.0") (if (null filename) (setq filename (getstring "\nPath and name of update file: "))) (if (null tcircuit) (progn (C:EQUIP2)) (progn (makenames tcircuit) (checklayers tcircuit))) (if (null tcircuit) (progn (princ "\nCurrent name has not been established") (princ "\nplease type EQUIP and establish current equip. or make new")) (progn (openfile) (seek-tcircuit) (if (= (getvar "userr1") 0.0) (setvar "userr1" 3.0)) (if (= (getvar "userr2") 0.0) (setvar "userr2" 1.0)) (if (ssget "X" (list (cons 8 "CIRCUIT-INFO") (cons 0 "TEXT"))) (uinfo) (repeat 2 (read-line infile))) (if (ssget "X" (list (cons 8 "TITLE") (cons 0 "TEXT"))) (udates) (repeat 2 (read-line infile))) ;; (uinfo) ;; (udates) (if (= found 1) ;; (progn (udp) (uext) (uldar) (uvalve)) (princ "\nNO INFORMATION TO UPDATE")) (closefile))) (command "._-layer" "s" PIPING "") (princ)) I need to add to the code so that it will update the defined text strings of attributes within a block. IF you have any input or any questions I would appreciate everything.
  11. neko_designer

    beginner - code help

    hi, I just started reading about lisp and made my first "script", but it is giving me an error after drawing the first rectangle, and wont draw the next. can anyone tell me what am I doing wrong? thanks in advance (defun c:pl() (command "_thickness" 1 "") (command "_circle" '(0 0 0) 1 "") (command "_circle" '(10 10 0) 1 "") (command "_rectangle" '(0 0 0) "_Dimension" 4 5 "") (command "_rectangle" '(10 10 0) "_Dimension" 4 5 "") (princ) ;;clean exit )
  12. Hello all. I have a LISP routine that I have been using forever now so excuse me if it is written sorta outdated to what it could look like if it were updated. It is a balloon(bubble) routine to insert letters or numbers inside a sized bubble with a line and an arrow. The problem I am having is that when running the command after selecting my first point i have to physically turn off OSNAP then after I enter the numbers and finish the command turn OSNAP back on because if I do not it distorts the arrow... I have a mouse with extra programmed buttons that allows me to speed up the process as if it never happens, but still thats not the point. It would be nice to just keep all my snaps on all the time and let the code and just continue to breeze through my drawings. I have tried a few things and I am finished with trying for now. Besides I have others in my cad department that have regular mice and we all believe it could be made better. Figured I would take it to the CAD community, because after all I know this is what some of you live for also. So to sum it up I am basically looking for the code to be revised so that when I start the command it will change OSMODE properly to allow for everything to be entered with no problems. Whether SNAP is turned off/on of OSMODE is altered I do not really care just as long as SNAP IS ON DURING FIRST USER POINT so that my leader is on my pipe and SNAP IS BACK TO ALL ON after the command. THANKS THANKS THANKS IN ADVANCE! Sorry if I am missing it guys, I have tried. Here is the code: ************************ DATAPOINT BUBBLE INSERTION ************************** (defun c:BALLOON (/ oldlayr oldos) (setq oldlayr (getvar "clayer")) (command "._-layer" "s" TEXT "") (initget (+ 1)) (setq pt1 (getpoint "\nDatapoint location on pipe: ")) ; Get 1st loc (initget (+ 1 32)) (command "OSNAP" "NONE") (setq pt2 (getpoint pt1 "\nDatapoint bubble location: ")) ; Get 2nd loc (initget (+ 1 2 4)) (if (= etype "G") (progn (setq dps (strcase (getstring "\nEnter datapoint ID (A1 - A999) or (A1 - AZ99): "))) ; Get DP# (if (< (strlen dps) 3) (setq csize (* (getvar "userr1") 1.2)) ; balloon for A1 (progn (if (< (strlen dps) 4) (setq csize (* (getvar "userr1") 1.9)) ; balloon for A22 (setq csize (* (getvar "userr1") 2.3)) ; balloon for A333 ) ) ) ) (progn (setq dpnum (getreal "\nEnter datapoint number (1.0-999.9): ")) ; Get DP# (setq dps (rtos dpnum 2 1)) (if (< (strlen dps) 4) (setq csize (* (getvar "userr1") 1.6)) ; balloon for 9.9 (progn (if (< (strlen dps) 5) (setq csize (* (getvar "userr1") 2.0)) ; balloon for 99.9 (setq csize (* (getvar "userr1") 2.4)) ; balloon for 999.9 ) ) ) ) ) (command "._circle" pt2 csize) (setq a (angle pt2 pt1)) (setq OLDOS (getvar "OSMODE")) (setvar "OSMODE" 0) (command "._line" pt1 (osnap (polar pt2 a csize) "nearest") "" ) (setvar "OSMODE" OLDOS) (command "._solid" pt1 (polar pt1 (- a 85) (getvar "userr1")) (polar pt1 (+ a 85) (getvar "userr1")) "" "") (command "._text" "m" pt2 (GETVAR "USERR1") 0 dps) (command "._-layer" "s" oldlayr "") (prin1))
  13. Just finished writing this tutorial with the aim to provide an overview of the various ways to debug code using the Visual LISP Editor. I've tried to incorporate many facilities of the VLIDE into the tutorial, so excuse me if it seems a tad drawn out in places. Of course, comments for improvements are welcome, along with the discovery of any typos & mistakes (there are bound to be some!) http://lee-mac.com/debugvlide.html Enjoy, Lee
  14. Morning again, Is there a lisp or piece of code that would change the contents of a block to Layer 0, so I can set it down in my Layering Standard rather than the standard the block was created in (not by me). Look forward to hearing from you Stenna
  15. Just experimenting with the 'while' function and looking for feedback as to the quality of my coding. (defun c:test (/) (setq count 0) (setq 5dig (getint "\nEnter a 5 digit number: ")) ;_Enter a 5 digit number. (while (/= count 5) (setq 5dig (getint "\nTry again, please enter a 5 digit number: ")) (setq strcount (itoa 5dig)) ;_Set a variable "strcount" to string from the interger from the variable "5dig" (setq count (strlen strcount) ;_Count the length of characters in the variable "strcount" ) ) (princ "\nYour are the Winner!") (princ) ) Thanks
  16. Mbeis

    DXF 3D Anatomy

    Can anyone help me find a good resource on how to create a 3D DXF file from scratch? I am a developer working on a tool that can create cylindrical shapes from schematic drawing coordinates.
  17. Hello. My problem occurs when i have this railway assembly and want to create a surface from its bottom, (called "Datum" in english?). I have given the link at the bottom of the subbase the Code "Terrass" but it doesnt even show up when im in "corridor surfaces"-->add data--Specify code. None of the codes of the subbase shows up. What is wrong here? Im using civil 3d 2013
  18. Hi I'm new to the forum, and i hope someone can help me ! I'm currently using Inventor 2012 and i need a macro (code): I want to know if it's possible to export all the information from the parameters list (everything, names, values, tolerances, comments...) to an excel spreadsheet or a txt file (it can be a table, or a CVS file, i just want that information!), from a part file (.ipt) or a drawing file (.dwg). Currently, i can only export the parameters' names and values , but i can't get to the tolerance values and comments . . . Is there anyway to do this ? Many thanks, Regards JVC
  19. tigger29900

    Clear Button

    Hi i was looking to create a button that sets all the unlocked layers in my drawing back to color 7 I've been trying to get it but no luck any help would be appreciated
  20. I have been trying to work out a quick solution to a problem using .net but have been stumped by my lack of knowledge in programming. I need to write an app/plugin for autocad that will change the color of a layer when a checkbox is checked. I have been able to set up the user form but i am not sure how to code the actual changing of layer colors. Another feature i am trying to incorporate is the output filtering of the text contained on the layer which have had their colors changed to build an effect equipment list Any help would be greatly appreciated
  21. MKearney028

    Daylight Subassembly Linetype

    When creating an assembly with daylight lines, I use the DaylightGeneral subassembly and add a material thickness to show the depth of the material. One thing I cannot figure out is how to change the linetype of the bottom of the material. The link code for the bottom line is "Datum", so if I change that in my code set style, then it will change all of the datum links to the different linetype. Does anyone know if there is a way to change this without creating a custom subassembly? Thanks.
  22. I was wondering if anyone here can find the problem in this hatch pattern as I'm sure I've used it before but now AutoCAD 2009 LT tells me it cannot read the hatch pattern? I've attahced the hatch pattern file. If somone could please find the issue in the file and send it back then I'd be very grateful! As I've had a quick look myself but i'm not 100%. I know it has to have an empty line after the code but I've checked that and it can't be that! Hoping someone may know more than me? Thanks everyone! (P.S; i couldn't upload it as a .PAT so copied and pasted the whole hatch file into notepad and made it a .txt) (P.P.S; apologies, perhaps should have started this thread in the 2D drafting sub-menu! ) Hatch pattern 1.txt
×
×
  • Create New...