Jump to content

Search the Community

Showing results for tags 'block'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

  1. Can someone help me out with changing the attributes of a block using a list. The block is used in a leader. The block has 7 attributes, but my list doesn't always contain 7 variables. I have tried to implement Lee Mac's code dynamicblockfunctions, but I keep getting the error "too few arguments". I would like to import the leader when the calculation is done, and for the block to then automatically change the attributes to the variables in the list. Here's my current code: (defun c:testKRIS ( / *error* dch dcl des mv d1 d2 d3 d4 d5 d6) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ( (progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" " edit_width = 10;" " fixed_width = true;" "}" "" "test : dialog" "{" " spacer;" " key = \"dcl\";" " : ed" " {" " key = \"mv\";" " label = \"MV:\";" " }" " :boxed_column { " " label = \"Diepte vd buizen\";" " :row {" " : ed" " {" " key = \"d1\";" " label = \"A:\";" " }" " : ed" " {" " key = \"d4\";" " label = \"X:\";" " }}" " :row {" " : ed" " {" " key = \"d2\";" " label = \"B:\";" " }" " : ed" " {" " key = \"d5\";" " label = \"Y:\";" " }}" " :row {" " : ed" " {" " key = \"d3\";" " label = \"C:\";" " }" " : ed" " {" " key = \"d6\";" " label = \"Z:\";" " }}" " }" " : boxed_row" " { " " label = \"BOK berekeningen\";" " :column {" " : ed { key = \"res\"; label = \"BOK:\"; is_enabled = false; }" " : ed { key = \"res2\"; label = \"BOK2:\"; is_enabled = false; }" " : ed { key = \"res3\"; label = \"BOK3:\"; is_enabled = false; }" " }" " :column{" " : ed { key = \"res4\"; label = \"BOK4:\"; is_enabled = false; }" " : ed { key = \"res5\"; label = \"BOK5:\"; is_enabled = false; }" " : ed { key = \"res6\"; label = \"BOK6:\"; is_enabled = false; }" " }" " }" " : button" " {" " key = \"cal\";" " label = \"Calculate\";" " }" " spacer;" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "test" dch)) (princ "\nUnable to display 'test' dialog.") ) ( t (set_tile "dcl" "Calculate Area") (action_tile "mv" "(setq mv $value)") (action_tile "d1" "(setq d1 $value)") (action_tile "d2" "(setq d2 $value)") (action_tile "d3" "(setq d3 $value)") (action_tile "d4" "(setq d4 $value)") (action_tile "d5" "(setq d5 $value)") (action_tile "d6" "(setq d6 $value)") (action_tile "cal" (vl-prin1-to-string '( (lambda ( / m x y z a b c lijst_results ) (setq lijst_results '()) (set_tile "res" "") (set_tile "res2" "") (set_tile "res3" "") (set_tile "res4" "") (set_tile "res5" "") (set_tile "res6" "") (setq m (distof mv)) (if m (progn (setq lijst_results (append lijst_results (list (strcat "mv: " (rtos m 2 2))))) (if (and d1 (setq a (distof d1))) (progn (setq lijst_results (append lijst_results (list (strcat "A: " (rtos (- m a) 2 2))))) (set_tile "res" (rtos (- m a) 2 2)))) (if (and d2 (setq b (distof d2))) (progn (setq lijst_results (append lijst_results (list (strcat "B: " (rtos (- m b) 2 2))))) (set_tile "res2" (rtos (- m b) 2 2)))) (if (and d3 (setq c (distof d3))) (progn (setq lijst_results (append lijst_results (list (strcat "C: " (rtos (- m c) 2 2))))) (set_tile "res3" (rtos (- m c) 2 2)))) (if (and d4 (setq x (distof d4))) (progn (setq lijst_results (append lijst_results (list (strcat "X: " (rtos (- m x) 2 2))))) (set_tile "res4" (rtos (- m x) 2 2)))) (if (and d5 (setq y (distof d5))) (progn (setq lijst_results (append lijst_results (list (strcat "Y: " (rtos (- m y) 2 2))))) (set_tile "res5" (rtos (- m y) 2 2)))) (if (and d6 (setq z (distof d6))) (progn (setq lijst_results (append lijst_results (list (strcat "Z: " (rtos (- m z) 2 2))))) (set_tile "res6" (rtos (- m z) 2 2)))) (print lijst_results) ) (alert "Vul maaiveld waarden in.") ) ) ) ) ) (start_dialog) ) ) (*error* nil) (princ) )
  2. Long time lurker and user of the site. Apologies my first post is a question rather than an answer but now I’ve made the leap of faith who knows the possibilities! I have a drawing with approx. 50 points in it. These points have been created from exporting a file from our MapInfo software into CAD format. Each of these points represents a feature (although everything contained within the drawing is just 1 feature) and I need to be able to attached a symbol (and then associated key) to define the feature when I xref in other similar drawings. I hope I described that ok. After some searching, I’m led to believe I need to use an LSP command/file/code etc.? I have no knowledge of anything LSP based, how to use it or where to begin. The instructions I’ve seen in other threads asking similar questions unfortunately go straight over my head. Could I ask is the LSP the only way to achieve my solution, and if so, is there a (very) basic step by step guide to using the LSP or could someone guide me through please? I understand that there is a need for full AutoCAD to perform this task – which I have access to if needbe.
  3. Hello everyone, can anyone help me, I have a case example that is almost similar to the actual case I am experiencing now. In the 1st picture I have a shapefile of the administrative boundaries of the United States that I have entered into autocad, the shp attribute has been entered into the data object of each feature with the data object name "GADM", in the data object there are State and County fields, for the layer of each feature I use the County field reference so that each feature is currently layered with its respective county name. what I want is that as in the 2nd picture I want each feature to be grouped or made per block per category of state, is there a quick way, because I think in each feature there is a State field? Noted: The Autocad that I use is AutocadMap 2021. Pic 1 Pic 2
  4. Hi, I am currently using Autocad 2011 and my block editor suddenly won't open this morning... I have tried the blockeditlock to open it but nothing happens when I change the setting (0 or 1). Have anyone ever had a problem like this one before? Please help!
  5. Hi, I tried to write an autolisp code and I got to a certain point, but it is not working as I wanted. I would like your suggestions and your support in revising the code. What I want to do is select a block. To find out which character (n) from the right is the "-" sign in the layer name of the line touching the block I selected. Then subtract 1 from this character(n) number and add n-1 from the right. Combining the part up to the character and the prefix text and writing to the block geometric point. The way this code works now is to combine the front text and the text to the right of the "-" sign of the last layer added to the layer list and write it to the center of the block. This wasn't something I wanted. (setq *textHeight* 8) (setq *layerName* "01 Equipment list 2") (setq *textColor* 1) ; (defun c:bs_ayar () (setq *textHeight* (getreal "\nEnter new text height: ")) (setq *layerName* (getstring "\nEnter new layer name: ")) (setq *textColor* (getint "\nEnter new color index (1 for Magenta): ")) (princ (strcat "\nText height is now " (rtos *textHeight*) ", layer name is " *layerName* ", color is " (itoa *textColor*) " was set to. ")) (princ) ) (defun c:bs4 () (setq prefix (getstring T "\nEnter prefix letter: ")) (setq blk (car (entsel "\nSelect Block: "))) (setq blkEnt (entget blk)) (setq insPt (cdr (assoc 10 blkEnt))) (setq ss (ssget "_X" (list (cons 0 "LINE,POLYLINE")))) (if (and ss (> (sslength ss) 0)) (progn (setq line (ssname ss 0)) (setq lineEnt (entget line)) (setq lineLayer (cdr (assoc 8 lineEnt))) (setq dashPos (vl-string-search "-" lineLayer)) (if dashPos (setq rightPart (substr lineLayer (+ dashPos 2))) (setq rightPart lineLayer) ) (command "._-LAYER" "_M" *layerName* "" "_C" *textColor* "" "") (command "._TEXT" insPt *textHeight* "" (strcat prefix rightPart)) (command "._-LAYER" "_S" *layerName* "") ) (princ "\nNo line or polyline was found touching the selected block.") ) (princ) )
  6. Working to standardize a bill of material drawing that must consist of nothing more than text, lines, and blocks for a client that refuses to use datalinks and I was hoping to find a way to create a standard block that could act as a row in the table with cells containing text fields. Essentially, I would like to have the functionality of attribute definitions but have them copy down using some kind of array action. Has anyone had any luck/experience with something like this? I understand it's might be kind of impossible. Attached is what I'm hoping to have as default text in the newly generated row as the user pulls down the array arrow.
  7. I received a drawing that contains a layer in the manager box. But when I attempted to Quick Select that layer, the result returns as "0" and this same layer cannot be deleted, since the message tells me that layers with objects cannot be deleted. I thawed all layers and still get "0" and the layer won't delete. This should mean that the layer is hidden inside a block. This drawing has several hundreds of blocks! Is there an application within AutoCAD that will reveal to me which block that layer is in?
  8. samifox

    protecting dynamic blocks

    Hi i want to develop commercial dynamic blocks, is there a way to protect them against piracy? Thanks S
  9. 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
  10. So I have been trying to figure this out with several approaches now and I need some help. I would like to send all Wipeouts, or really any specified entity type, within a block to the back of the draw order. Is there a way to do this using Lee Mac's Apply To Block Objects routine? I tried this in conjunction with his draw order routines but the MovetoBottom command kept failing. I'm pretty rough with VisualLisp which is part of the issue when trying to troubleshoot his great routines. Or what about this approach? (I dont really understand it, again Visual Lisp) Below is what I tried. I do understand Vanilla Lisp. Visual Lisp I barely know the basics, but eager to learn. Please help me improve my capabilities. I love autolisp. Thank you. The issue is clearly with the lambda function and my improper use of it Im sure. The ssget I am trying to do is incorrect approach for use with his function. ;=========================================================== ; 11/Sep/2020 10:09 AM[Friday] AUTHOR: Brandon Gum ;-- ;DESCRIPTION: ;Select block with wipeout. ;Will send wipeout objects the back of the draw orer ;=========================================================== (defun c:test ( / s ) (princ "\nSelect Block: ") (if (setq s (ssget "_+.:E:S" '((0 . "INSERT")))) (LM:ApplytoBlockObjects (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (vla-get-effectivename (vlax-ename->vla-object (ssname s 0))) '(lambda ( obj ) (BG:WipeoutToBottom)) ) ) (princ) ) (vl-load-com) (princ) (defun BG:WipeoutToBottom( / ) (LM:movetobottom (ssget "X" '((0 . "WIPEOUT")))) ;(princ) );end of defun ;===============Below here are Lee's draw order functions============== My LeeMac Based Approach.LSP
  11. Hi, I am Michel Can you kindly to help me to. I need a lisp for a cable routing. I have just a block consist of 3 attributes (TAG, SRTP, MVZ). I need to extract each relating value in separate column in excel. For example, if I select 5 blocks in drawing, I need to have 5 columns, each column has only 3 rows (3 attributes) and the possibility to have different rows for different electric cables in same file. Thank you in advance Michel richiesta.xlsx
  12. I found valuable lisp for auto creation block. I want to improve this lisp to following requirement * block selected object individually, not in one block thanks AUTO-BLOCK.LSP
  13. Hi, I would like to know some help. 01 - Is there a possibility in this Lee Mac lisp, Automatically Label Attributes, that it can be changed so that every time I open a different file it asks me about the increment, prefix and suffix settings? Because in the current way it always loads the pre-configuration that is already in lisp. I don't want to have to edit the lisp to configure the numbers for each file. Note: I use attributed blocks and multileader blocks. 02 - I also use the Lisp Incremental Numbering Suite, I would like to know if the option for multileaders can be added. As the current options are only for text, mtext and blocks. For my use multileaders are more interesting. Because the use of block with attributes will have to be manually making the leader lines to indicate their positions and references after their insertion and when you have many blocks end up wasting valuable time. I would like to know if it is possible to make any of these changes, since lisps have many lines. Note: Sorry for the google translation. #NumIncV3-9.lsp AutoLabelAttributesV1-4.lsp
  14. What command can I use to find a block by its name in my drawing and then delete it?
  15. G'day all I'm working on and editing a mapping project from photogrammetry. I have a block which indicates a square manhole cover. (File is attached to this post) My project area has hundreds of these manholes and my client needs each of them scaled and rotated to fit the exact size of the manhole. I had been manually doing this with the help of an ECW image in the background. But the process is rather tedious and not all that accurate. My operators can pick up a three point string showing the height and length of the manhole. Some manholes are square and some are rectangular. I have a few lisp routines that get the block in there. The block insertion point comes in at the first plotted point as required. Is there any similar LISP that will insert the attached block dwg file at the first point collected and scale it based on the 2nd and third point whilst keeping the elevation heights? I've attached two dwg files... One is the block itself and one is a diagram with a better explanation. I've also added a screen shot of what is required. Any help would be appreciated Cheers guys Manhole.dwg BlockSample.dwg
  16. Hey, I draw ventilation ductwork all day at work, just recently stumbled across dynamic blocks and could do with a little help with one. Attached is what i have done so far, the straight section works perfectly, just having some trouble with the radius bend. What I need is for the arc to stretch with the angle of the bend. :/ I appreciate any help, and feel free to use my working block. TEST.dwg
  17. I'm trying to modify some code to achieve the following: Ask the user to pick multiple blocks, step through each block, get the extents of the block, and save a view with the view name equal to the name of the block. Doing some research I've managed to get the extents of the block but can't figure out how to store the block name as a variable and use it as the view name. The code I found will draw a rectangle around the block using vla-getboundingbox but I can't figure out how to assign the name of the block to a variable for use in the -view command. I have a few hundred blocks in the same drawing. Existing code is: (defun c:BlockExtentsToRectangle (/ BlockObject mn mx) (vl-load-com) (if (setq BlockObject (car (entsel "\n >> Select Object >> "))) (progn (vla-getboundingbox (vlax-ename->vla-object BlockObject) 'mn 'mx) (vl-cmdf "._rectang" (vlax-safearray->list mn) (vlax-safearray->list mx)))) (princ) )
  18. Drawing A: old tag definition Drawing B: new tag definition Hi Guys, I have an opened drawing file A with an old attribute tag definition and brought in another attribute block with the same name but having a new attribution tag definition from a drawing file B. I had purposefully purged drawing A’s attribute block containing the old tag definition, hoping to bring in the same-name attribute from drawing B, having new tag definition. It went well except the Enhanced Attribute Editor still contains the old tag definition of drawing A – even though Battman shows the new defined tags from drawing B. This means that I need to somehow, Purge the old defined tags from drawing A. Am I able to purge the attribute’s definition from a drawing? I am doing this so I may not have to change the attribute block’s name and keep the new tag definition. Thanks for your time, "Mitch"
  19. Does anyone know if it's possible to manipulate the vertical line spacing of multiline attributes within a block?
  20. 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
  21. Hello, i try to insert block view in dcl format. I want when i chose block name to have block view to. Something like this.
  22. I found a lisp (attached) to change object line type. But this lisp is not changing nested blocks line types and forcing one by one selection . I need to change linetype of all objects include nested blocks and as area selection. Please help ChangeObjLinetype.lsp
  23. Hello! I'm looking for a solution to my problem. I have a block (center in the attached image) that I'd like to be able to scale as usual, but I want the red circle to remain the same size always. This particular one is a symbol for a smoke detector and the red circle is supposed to be the coverage of this detector. That is why I want the coverage circle to remain a constant diameter of let's say 10 meters, but I'd still like to be able to scale the smoke detector symbol depending on viewport scale. I also want the circle to follow the detector so that I don't have to select both. Other requests are the ability to freeze or turn off visibility of the circle, but I'd still want it to follow the smoke detector if moved. Is any of this doable? What are your thoughts? Thanks!
  24. Can anyone help me for the create lisp for following condition . * I have 200 of text separately in my drawing ..i want block them individually each one. *i want select 200 of text at once block them individually .. Can any one create lisp for that.thank
  25. Hi guys, I am new to LISP and CAD customization at all, so what I am asking for is a guide where to look and how to approach my problem. Sorry for my English, I am not a native speaker. My goal is to create button which will insert a block into my drawing (I know how to do that), block is a simple circle with a number, which represent a reference for some element, a stud for example. What it should do.... 1) click a my made button which start inserting a block with a midpoint (done) 2) click in a drawing and insert the block to a anyplace I want (dont know how to continue inserting without hitting the button again) 3) inserting the block will still continue but now it will be second one(3rd,4th etc.) and the number in a circle will be increasing by 1 4) I would like to specify from which number the increment numbering should start.
  • Create New...