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 need help with a lisp routine to clean up architects drawings with the following. Unlock,Unfreeze & turn on all layers Burst Change all layers to bylayer Change all hatch’s to colour 254 and send to back Change all line weights to 0.18 Change all to Colour 8 Overkill Purge
  2. Hello everyone. This is my first time posting but i have enjoyed a lot of your great work. I use a lot a field about object/polyline/length - decimal 0 (copy it to different polylines and than get their lenghth) and i am tired of changing object from dialogbox. Is there an easy way (lisp or other) to change the object directly and get its length:):)
  3. Hello all, I would like to know if anybody has any bright ideas about a problem I face when drawing building elevations in 3D. I use 3D polylines to survey a facade on site. When back in the office I get an output of a 3D polyline with a point and node at each surveyed point. The point is aligned to 3d *top* view. I then rotate the current view aligned to the required building facade. My question is twofold: 1) Is there a way of rotating the point to see the point style in the current view? 2) As my point information plots in 3D as point, point number, and elevation is there a lisp routine to rotate the point number text and level text about the centre of the point to present as 'correct' in the current view? I don't expect miracles or written LISP routines but a couple of pointers would be really appreciated. Lownote
  4. Hey, I am looking to write a lisp routine that, among other things, creates a block and scales it in the x and y but not z (this is a requirement for a coordinate conversion from a client)... I haven't been able to figure it out yet. My thoughts were to add a sort of break in the command where the user can click on the block and change the scales manually, but I don't know how to add such a break. Here's my attempt: (DEFUN C:CC () (COMMAND "_.SCALE" "_ALL" "" '(0 0) 3.28084 "_BLOCK" "1" '(0 0) "_ALL" "" (prompt "change x and y scale of block to 1.025") break "_.explode" ) ) Any help would be appreciated. Thanks, CR
  5. For example lisp is drawing complicated shapes out of individual lines – is there a way to “pause” the display for the duration of the function, so that complete linework just show all at once, instead of each individual line with flickering screen? Many Thanks
  6. Greetings, Im working on a test lisp to see if I can automate binding an existing xref & converting a bounded block reference back into an xref. while I was able to automate bind, I realized the express tool (-blocktoxref) is incompatible with lisp as it cant seem to find the command. Then I created a script that allows me to set up an open command, but I cant seem to use my local variables (BLKNAME & NEWFILEPATH) with the script command. So my question is, Is it possible to write a script via lisp? and if so how? (defun c:ws_Layer_copy () (vl-load-com) (setq en (ssget "x" '((0 . "insert") (8 . "XREF - ELECTRICAL - 1")))) (setq ent (ssname en 0)) (setq EN (entget ent)) (setq layno (vl-string-left-trim "XREF - ELECTRICAL - " (cdr(assoc 8 EN)))) (setq dwgpath (getvar "dwgprefix")) (setq dwgname (getvar "dwgname")) (setq nametrim (vl-string-right-trim "HVAC LAYOUT.dwg" dwgname)) (if (= layno "1") (setq layname "1st") ) (if (= layno "2") (setq layname "2nd") ) (if (= layno "3") (setq layname "3rd") ) (if (= layno "4") (setq layname "4th") ) (if (= layno "5") (setq layname "5th") ) (setq newfilepath (strcat nametrim layname " Floor Electrical" )) (setq blkname (vl-string-left-trim dwgpath newfilepath)) (command "-xref" "bind" newfilepath ) ;---------------------------------------------------------------------- (command "script" "blocktoxref.scr" ) )
  7. hello, well i'm working on several floor, we got a block made by apartment, in each apartment, we gad lot of blocks, like exemple "bed", i'd like to select all the bed in one time to change the layer of this block, i don't want to enter the edit_block to change the layer of the lines, but to have the block "bed" set into the layer "mobilier" as an exemple, the filter selection by name do not recognize the block into a block, and neither the qselection. i hope someone can helpme, thanks it's my first post, and i don't speak english very often, so i'm sorry for my errors...
  8. Good afternoon, I am very new to LISP and need your help, at this point I can only make minor changes to existing code but a lot of the code still is magic to me. I have a block "ULTRA INFO" with an attribute "CIRCID" that can be used to help turn off a layer with that name that has "-DATA" added to the end. What I think we need to do is to grab the attribute variable and store it, then add a wild card * to the end, lastly have it turn off a layer with that name. Here is my thought: Some how scan the drawing for an attribute named "CIRCID" if it is found store it as "LAName" for later use. Then turn off the layer: (command "-Layer" "off" "(LAName)*" "") Any help possible is greatly appreciated. Thank you all in advance. Brian
  9. Hi Guys, New to CAD Tutor. I came here looking for a lisp routine to do multiple copies at varying distances from a point relative to the last copy point. I found Lee Mac's Lisp Routine on an old post but I am having trouble with it. I am using AutoCAD 2018. (defun c:copyrel ( / b i l o p q s ) (if (and (setq s (ssget "_:L")) (setq p (getpoint "\nSpecify Base Point: ")) (setq b (vlax-3D-point (trans p 1 0))) ) (progn (repeat (setq i (sslength s)) (setq l (cons (vlax-ename->vla-object (ssname s (setq i (1- i)))) l)) ) (while (setq q (acet-ss-drag-move s p "\nSpecify Second Point: " 0 0)) (setq s (ssadd)) (foreach x l (vla-move (setq o (vla-copy x)) b (vlax-3D-point (trans q 1 0))) (ssadd (vlax-vla-object->ename o) s) ) (setq p q) ) ) ) (princ) ) (vl-load-com) (princ) So it seems to work up until the second copy. The issue I have is that I am unable to control the direction of the second copy. Also the distance is incorrect for the direction it does copy it to. I am trying to use it to quickly draw a column grid. I have orthomode on. My first copy is horizontal, the second is also to be horizontal and all visual cues show as if it will be copied horizontally, just like the other copy. However, the result is that it copies the object downward. And not even to the correct distance. For example I typed in 20'-8" and it copied it 7' something down on the Y-axis. This is exactly what I am looking for so if anyone can help me out with this it would be fantastic!!
  10. Is there a quick and practical way to get X & Y values on a polyline other than by way of "LIST". because I need the X & Y value just like the 2nd image. Thank you Master. img 1 : https://drive.google.com/open?id=0B1KbDu2x_byvU2F6NlpvNWJrU0k img 2 : https://drive.google.com/open?id=0B1KbDu2x_byvVE9qdmpBLWcxWHM
  11. Hi to all, I have a problem with a code found on the internet (the code make a similar job lisp BLOCK COUNTER ). Lisp works fine with simple blocks...but when you select blocks with attributes in the column preview section, the selected block with attribute does not show the values entered when the block was inserted. Above does not even show the real name of the initial block. Below you have a dwg file with my blocks but also the Lisp code. (defun c:BlkQty (/ blk_id blk_len blk_name blks ent h header_lsp height i j TOTAL len0 lst_blk msp pt row ss str tblobj width width1 width2 x y ) ;; By : Gia Bach, gia_bach @ www.CadViet.com ;; (vl-load-com) (defun TxtWidth (val h msp / txt minp maxp) (setq txt (vla-AddText msp val (vlax-3d-point '(0 0 0)) h)) (vla-getBoundingBox txt 'minp 'maxp ) (vla-Erase txt) (-(car(vlax-safearray->list maxp))(car(vlax-safearray->list minp))) ) (defun GetOrCreateTableStyle (tbl_name / name namelst objtblsty objtblstydic tablst txtsty) (setq objTblStyDic (vla-item (vla-get-dictionaries *adoc) "ACAD_TABLESTYLE") ) (foreach itm (vlax-for itm objTblStyDic (setq tabLst (append tabLst (list itm)))) (if (not (vl-catch-all-error-p (setq name (vl-catch-all-apply 'vla-get-Name (list itm))))) (setq nameLst (append nameLst (list name))) ) ) (if (not (vl-position tbl_name nameLst)) (vla-addobject objTblStyDic tbl_name "AcDbTableStyle")) (setq objTblSty (vla-item objTblStyDic tbl_name) TxtSty (variant-value (vla-getvariable *adoc "TextStyle"))) (mapcar '(lambda (x)(vla-settextstyle objTblSty x TxtSty)) (list acTitleRow acHeaderRow acDataRow) ) (vla-setvariable *adoc "CTableStyle" tbl_name) ) (defun GetObjectID (obj) (if (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE")) (vlax-invoke-method *util 'GetObjectIdString obj :vlax-false ) (vla-get-Objectid obj))) ;main (if (setq ss (ssget (list (cons 0 "INSERT")))) (progn (vl-load-com) (setq i -1 len0 (while (setq ent (ssname ss (setq i (1+ i)))) (setq blk_name (cdr (assoc 2 (entget ent)))) (if (> (setq blk_len (strlen blk_name)) len0) (setq str blk_name len0 blk_len) ) (if (not (assoc blk_name lst_blk)) (setq lst_blk (cons (cons blk_name 1) lst_blk)) (setq lst_blk (subst (cons blk_name (1+ (cdr (assoc blk_name lst_blk)))) (assoc blk_name lst_blk) lst_blk))) ) (setq lst_blk (vl-sort lst_blk '(lambda (x y) (< (car x) (car y)) ) )) (SETQ TOTAL 0) (FOREACH I LST_BLK (SETQ TOTAL (+ TOTAL (CDR I)))) (or *h* (setq *h* (* (getvar "dimtxt")(getvar "dimscale")))) (initget 6) (setq h (getreal (strcat "\nText Height <" (rtos *h*) "> :"))) (if h (setq *h* h) (setq h *h*) ) (or *adoc (setq *adoc (vla-get-ActiveDocument (vlax-get-acad-object)))) (setq msp (vla-get-modelspace *adoc) *util (vla-get-Utility *adoc) blks (vla-get-blocks *adoc)) (setq width1 (* 4 (TxtWidth " " h msp)) width (* 2 (TxtWidth "Text Height" h msp)) height (* 2 h)) (if str (setq width2 (* 1.5 (TxtWidth (strcase str) h msp))) (setq width2 width)) (if (> h 3) (setq width (* (fix (/ width )8) width1 (* (fix (/ width1 )8) width2 (* (fix (/ width2 )8) height (* (fix (/ height 5))5))) (GetOrCreateTableStyle "CadEng") (setq pt (getpoint "\nPlace Table :") TblObj (vla-addtable msp (vlax-3d-point pt) (+ (length lst_blk) 3) 4 height width));CHANGE 5 TO 4 (vla-put-regeneratetablesuppressed TblObj :vlax-true) (vla-SetColumnWidth TblObj 0 width1) (vla-SetColumnWidth TblObj 1 width2) (vla-put-vertcellmargin TblObj (* 0.75 h)) (vla-put-horzcellmargin TblObj (* 0.75 h)) (mapcar '(lambda (x)(vla-setTextHeight TblObj x h)) (list acTitleRow acHeaderRow acDataRow) ) (mapcar '(lambda (x)(vla-setAlignment TblObj x ) (list acTitleRow acHeaderRow acDataRow)) (vla-MergeCells TblObj 0 0 0 3);change 4 to 3 (vla-setText TblObj 0 0 "CARTEA INDICATOARELOR RUTIERE") (setq j -1 header_lsp (list "NR. CRT." "DENUMIRE S.T.A.S. 1848-1/2011" "TOTAL INDICATOARE" "FIG. S.T.A.S. 1848-1/2011"));;;;;;;;;;;;;;;;;;;;;;REMOVE "DON VI" (repeat (length header_lsp) (vla-setText TblObj 1 (setq j (1+ j)) (nth j header_lsp))) (setq row 2 i 1) (foreach pt lst_blk (setq blk_name (car pt) j -1) (mapcar '(lambda (x)(vla-setText TblObj row (setq j (1+ j)) x)) (list i blk_name (cdr pt)));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;REMOVE "CAI" (vla-SetBlockTableRecordId TblObj row 3 (GetObjectID (vla-item blks blk_name)) :vlax-true);CHANGE 4 TO 3 (vla-SetCellAlignment TblObj row 1 7) (vla-SetCellAlignment TblObj row 2 9);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CHANGE 3 TO 2 (setq row (1+ row) i (1+ i)) ) (VLA-SETTEXT TBLOBJ ROW 1 "TOTAL") (VLA-SETTEXT TBLOBJ ROW 2 TOTAL) (vla-SetCellAlignment TblObj row 1 7) (vla-SetCellAlignment TblObj row 2 9) (vla-put-regeneratetablesuppressed TblObj :vlax-false) (vlax-release-object TblObj) ) ) (princ)) [ATTACH]62448[/ATTACH] Have a nice day to all ...
  12. I've been of the drawing circuit for a while now because I've been undertaking rack safety inspections. I came back to drawing some elevations the other day and decided there must be an easier way to draw these damn window mullions. Now, I've had a look around my usual sources and can't find anything that's doing what I'd like. I did look at this for example, but it's not quite what I need, especially given that we work to a different scale: http://www.cadtutor.net/forum/showthread.php?11921-Easy-lisp-brain-fart&highlight=window+mullions Basically, I need to be able to select a window opening, choose an offset distance for the frame and then select how many boxes are to fit in there (rows & columns) and the distance between them. Each box (pane of glass) would then be offset 10mm for emphasis. I profess to not be very competent at lisp routines, but from my brief experience I don't expect this to be too complex? If anyone has something that I can work with or can create something for me that'd be much appreciated!
  13. Hello everyone. I just started reading stuffs and tutorials about lisp programming because I want to make a surveying program because I cant afford to buy one. Also, I want to learn the beauty of lisp. What I want is that to input first all the necessary data (name of lot, lot owner, location, geodetic engineer, date of survey, etc) which can be used for the other lisp program i will be making. My problem is I dont know how to start this. I know that the community here is very helpful so thanks in advance. God bless
  14. Dear folks, There is an idea to get things easier in my workflow but I need check if it is possible or not. There are over 100 closed polyline objects on the model and each has a unique ID written in its Hyperlink value (like X_D_YYYY) And each of these polylines has a block placed in the enclosing area with an attribute. My aim is to get the Hyperlink from enclosing polyline and populate the block attribute with that value. You may find an example as DWG at the attachment. Regards. get-Enclosing-polyline-data.dwg
  15. I had this from Lee, but usually always go way counter-clockwise and only select the polyline, not the point. ;; Polyline Vertex Exporter ~ by Lee McDonnell ~ 26.11.2009 (defun c:pExp2 (/ ss tmp i j ent tot dis pt) (vl-load-com) (if (and (setq ss (ssget '((0 . "*POLYLINE")))) (setq tmp (getfiled "Output File" (cond (*load) ("")) "txt;csv" 9))) (progn (setq *load tmp tmp (open tmp "a") i -1) (write-line "X,Y,Layer" tmp) (while (setq ent (ssname ss (setq i (1+ i)))) (setq tot 0. j (1- (vlax-curve-getStartParam ent))) (while ( (setq pt (mapcar 'rtos (vlax-curve-getPointatParam ent j))) (write-line (strcat (car pt) (chr 44) (cadr pt) (chr 44) (vla-get-layer (vlax-ename->vla-object ent))) tmp)) (write-line "" tmp)) (close tmp))) (princ)) THX for any tips.
  16. Hi all, I came across a LISP routine that freezes the layer of any selected object. It works great but I want it to viewport freeze layers, not freeze for the entire drawing. This is where I found it: http://forums.augi.com/showthread.php?78426-Special-Layer-Freeze-LISP-Routine and this is the code I'd like to have modified: (the code wrap button doesn't seem to work) (defun c:LFR (/ CLayer$ EntList@ EntName^ Layer$) (setq CLayer$ (getvar "CLAYER")) (princ "\nSelect object on layer to freeze") (if (setq EntName^ (car (entsel))) (progn (setq EntList@ (entget EntName^)) (setq Layer$ (cdr (assoc 8 EntList@))) (if (and (= Layer$ CLayer$)(/= Layer$ "0")) (command ".LAYER" "T" "0" "U" "0" "ON" "0" "S" "0" "") );if (if (= Layer$ "0") (princ "\nCannot freeze layer 0.") (command ".LAYER" "F" Layer$ "") );if );progn );if (princ) );defun c:LFR [code] I also attached the actual .LSP file to make it easier. LFR.LSP
  17. I have a vector map of a floor and all i am given are vectors and grade ratios (i.e. 1:155.095, 1:97.561) of the floor. The problem is that I only want to look at the areas of the floor that are below a certain grade ratio (1:69), but they are ratios set as Text Contents so AutoCAD doesnt understand that these ratios are numbers. I am looking for a Lisp function that, for each text if a ratio across an entire floor (or the layout), copy the text (which is a ratio), find out the number that the ratio is (i.e. take the 1 and divide by 69), then replace the text with just the number (0.0145). I want this to do this for every instance, and there are over 37,000 of these texts on the floor in question. I have attached an image that depicts what I have in the layout. Does anyone know of a lisp function that can do this?
  18. Hello, Is there a LISP to make text middle justified?
  19. I need a script that will convert multiple DWG files to ONE single PDF file,I found one that does convert the dgw file but to single pdfs , im also having some issues with DWG files that are "read only" wont convert them but all my files i need to convert to pdf are READ ONLY.
  20. Dear folks, We all know that Revit has tagging capabilities and I know that AutoCAD can also do that with Lisp. Lets assume we have 5 different solid hatch each in different layers like: Layer Name - L1 Layer Name - L2 Layer Name - L3 Layer Name - L4 Layer Name - L5 I want to place a block named LNAME with an attribute and place them onto hatches and get the Object->Layer proporty in it. I attached the sample file. Thanks in advanced. MA LISP-TAGGING.dwg
  21. My lisp program runs the offset command, then immediately uses entlast to get the newly created polyline and add it to a selection set. There is a bug using this method, though, since offset creates multiple entities any time the offset distance is large enough to make it collide with itself. I am trying to find a way to get those additional polylines, but entlast only grabs the most recent. I am at a loss. The only things I can think of right now are to either write my own custom offset routine or to select everything in the drawing before and after the offset, then deselect the selection from before. Both methods sound inefficient. Does anybody have a better way of going about this? I found a few posts where people asked similar questions about this problem, but each one found a workaround specific to their case instead of addressing the issue of getting more than one recent entities which are output at the same time. For reference, here is what I'm talking about by multiple entities being created when it self-intersects:
  22. ryankevin15

    ..........

    .....
  23. I want to insert a block on the Intersection of a selected Circle and Polyline using lisp.
×
×
  • Create New...