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. Hello, I am looking for a lisp that would add a block (ex. arrow) to the each endpoint of a pline and align it with that pline. Any ideas? Thank you in advance.
  2. So dealing with mlines specifically..I was hoping to insert a block specified in the code at the endpoints only.. Lee's been a huge help..actually just today helping me with the following to insert a block on everything but the endpoints, which is perfect for inserting ftgs! This potential code could help us to insert a point load/# of studs (a 4" solid square block) at the end of all beams/hdrs that we draw with mlines. This would be such a big help as I alone go through about 200 of these in a day..that could potentially be completed with 3 clicks..fingers crossed..Any help is appreciated. --------- ;;-----------------=={ Block At Vertices }==------------------;; ;; ;; ;; Inserts a Block at each vertex of selected Polylines, ;; ;; with the exclusion of start/end vertices ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;;------------------------------------------------------------;; (defun c:BlockAtVertices ( / *error* _StartUndo _EndUndo _Insert _AngleAtParam doc block ss ) (vl-load-com) ;; © Lee Mac 2010 (setq block "endtick.dwg") ;; << Block Name (defun *error* ( msg ) (and doc (_EndUndo doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (defun _StartUndo ( doc ) (_EndUndo doc) (vla-StartUndoMark doc) ) (defun _EndUndo ( doc ) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-EndUndoMark doc) ) ) (defun _Insert ( block point rotation ) (entmakex (list (cons 0 "INSERT") (cons 2 block) (cons 10 point) (cons 50 rotation) ) ) ) (defun _AngleatParam ( entity param ) (angle '(0. 0. 0.) (vlax-curve-getFirstDeriv entity param)) ) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ( (= 4 (logand 4 (cdr (assoc 70 (tblsearch "LAYER" (getvar 'CLAYER)))))) (princ "\n** Current Layer Locked **") ) ( (not (or (and (tblsearch "BLOCK" (vl-filename-base block)) (setq block (vl-filename-base block)) ) (and (setq block (findfile (strcat block (if (eq "" (vl-filename-extension block)) ".dwg" "") ) ) ) ( (lambda ( / ocm ) (setq ocm (getvar 'CMDECHO)) (setvar 'CMDECHO 0) (command "_.-insert" block) (command) (setvar 'CMDECHO ocm) (tblsearch "BLOCK" (setq block (vl-filename-base block))) ) ) ) ) ) (princ "\n** Block not Found **") ) ( (not (setq ss (ssget '((0 . "*POLYLINE"))))) (princ "\n*Cancel*") ) (t (_StartUndo doc) ( (lambda ( i / e ) (while (setq e (ssname ss (setq i (1+ i)))) ( (lambda ( param end ) (while (< (setq param (1+ param)) end) (_Insert block (vlax-curve-getPointatParam e param) (_AngleAtParam e param)) ) ) (vlax-curve-getStartParam e) (vlax-curve-getEndParam e) ) ) ) -1 ) (_EndUndo doc) ) ) (princ) ) --------- (These two codes may be from Alanjt though not positive..maybe from a thread he referenced but have since lost that page..sorry!) (defun c:aaa () (vl-load-com) (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq obj (vlax-ename->vla-object (car (entsel)))) (setq c (vlax-get obj "Coordinates") i 0) (repeat (/ (length c) 3) (setq x (nth i c) y (nth (1+ i) c) z (nth (+ 2 i) c)) (vla-addtext *model-space* (rtos z 2) (vlax-3d-point (list x y 0.0)) 3.0) (setq i (+ i 3)) ) (princ) ) (defun c:aaaa () (vl-load-com) (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq obj (vlax-ename->vla-object (car (entsel)))) (setq c (vlax-get obj "Coordinates") i 0) (repeat (/ (length c) 2) (setq x (nth i c) y (nth (1+ i) c)) (vla-addcircle *model-space* (vlax-3d-point (list x y 0.0)) 3.0) (setq i (+ i 2)) ) (princ) )
  3. It's about time I started using Dynamic Blocks but all the lititure I find for it makes what I guess is realitively easy into a mystery. If I have a new layer called "PL" and draw a rectangle with it and then do a solid fill also on layer PL and make it a block: How do I make the fill switchable between visible or not and choose it's colour? Add things like stretchable in certain directions etc. (Plan view of windows are a good example of when that is handy) If I can get these answers for a simple rectangle I should be able to fathom it out for more involved blocks.
  4. i want to be able to create a something in a drawing template so that every time i open up the template a pop up will open to ask me to put in the drawing number, title, date etc. can anyone help?
  5. Hi all, As everyone has been more than helpful in previous posts I thought I'd ask if anyone knew if the following was possible. As a result of onsite coding my data input to CAD is pt number, elevation text, site notes and where appropriate blocks. With the tree blocks I manually scale the crown and trunk via dynmaic block manipulation as below. I wondered if scaling the crown and trunk elements was possible with a lisp routine? Any thoughts how I might go about this would be welcomed. Kind regards as always. Lownote1980
  6. I have done a fair bit of web scouring to find a good method for replacing multiple blocks. There are some pretty decent vba codes out there for block replacement, the Office Optimum "Replace Block" tool, for instance worked okay, but you have to buy it. I have also found some effective .NET solutions for importing block definitions from another drawing to override the definitions in the current drawing. However I keep wondering if there is a good (free) solution for replacing and redefining large numbers of blocks using lisp. I am sure it must be doable. I know this has been discussed before here, but I haven't seen anything yet which uses a simple customisable table to handle lots of replacements at once (Please chastise me if I'm wrong). There are lots of 'piece meal' type block replacement lisps on offer, which rely on either specifying block names from drop down lists, or selecting blocks on the screen. I want something which handles lots of block exchanges at once. I would ideally like a lisp which allows me to set up a table of existing block names, with the filepath for the replacement block along side it. I would like it to resemble this lisp for renaming blocks (i.e. using a table): (defun c:renameb (/ btable badt) (setq btable '(("OLDNAME#1" . "NEWNAME#1") ("OLDNAME#2" . "NEWNAME#2") ("OLDNAME#3" . "NEWNAME#3") ("OLDNAME#4" . "NEWNAME#4") ("OLDNAME#5" . "NEWNAME#5"))) (foreach b btable (cond ((and (not (tblsearch "BLOCK" (cdr b))) (tblsearch "BLOCK" (car b))) (command "_.RENAME" "_Block" (car b) (cdr b))) ((tblsearch "BLOCK" (cdr b)) (setq badt (cons b badt))))) (and badt (prin1 badt) (alert "Unable To Rename All BLOCKs")) (prin1)) I want a block replacement lisp which uses a table to identify the filepath of the replacement block. I also want the routine to tell AutoCAD to replace the definition of any existing blocks with the same name as the one being brought in. Alanjt notes here that the use of the equals sign in the following line achieves that: (vl-cmdf "_.-insert" (strcat nb "=") nil) I also want to preserve the attribute values in the existing drawing. I want to be able to control the scale of the blocks being brought into the drawing as replacements. I want to ATTSYNC replacement blocks. Marijn incorporated the following in a reply to a thread posted yesterday. See here. (if (tblsearch "BLOCK" "OLDNAMEOFBLOCK") (progn (command "-rename" "b" "OLDNAMEOFBLOCK" "NEWNAMEOFBLOCK") (command "_.-insert" "NEWNAMEOFBLOCK=FILENAME" "y" nil);replaced convert template to new template. (command "_.attsync" "n" "NEWNAMEOFBLOCK") (scl 0.8 "NEWNAMEOFBLOCK");scales block to new scale (blknr13 "NEWNAMEOFBLOCK"); this was command to set a block the a layer. (not included can eb removed) )) This takes care of the ATTSYNC and the scale specification. I'd like the OLDNAMEOFBLOCK and NEWNAMEOFBLOCK to essentially be variables, which draw on a pre-defined table to derive values and then apply the commands. Is this possible? I guess I'd be just as happy to input all the values one by one in an unhealthily long code, but a more streamlined answer would be nice. By the by, Marijn's code aimed to incorporate replacing tag names also, when one block is replaced. Interesting. Haven't tried it out properly yet. I would greatly appreciate some assistance in addressing and integrating the requirements outlined above in one amazing 'table based' lisp. I have already sent a post card to Santa politely asking for this for Christmas, so if I'm unsuccessful here, I always have christmas day as a backup.
  7. bobsy852

    Locked block

    My colleage asked me thisafternoon about a block he had in a drawing sent from a client which he wanted to explode and move a red box on this block to a new area. Now he used the explode command like you do and nothing happened. So I suggested that possibly it was a read-only file, but we could edit other areas of the drawing and he had already copied this block once into another area of the file. Does anyone know if it is possible to lock a block or why it is not possible to alter it? For now he's managed to find a way around this issue, but it's nice to further the experience on CAD incase this issue pops up again! If it helps, I will get a copy of the file as soon as he's finished working on it and upload it to this thread to see if anyone else can figure it out. Although you may know already? Thanks everyone!
  • Create New...