Search the Community
Showing results for tags 'elements'.
-
Hello. Is it possible to write a lisp routine that could get all elements in model space, take whatever layers they are on, and extract all the layer properties into a spreadsheet? I have attached a sample cad file replicated to what I need to do. so basically, we get a raw cad file which some of the elements are being controlled by the colors. Now, I need to put the elements according to the following layer naming convention: Layer Cyan >> TL-1 Layer E >> TL-2 Layer Green >> TL-3 Layer RedStuff >> TL-4 Layer GROUND >> TL-5 Layer Yellow >> TL-6 But my problem is some other elements are on the same layer but different in color which is supposed to be put on a different layer such as: Color magenta >> TL-7 color blue >> TL-8 color whit >> TL-9 I only thought maybe I could just get all the elements properties and sort it out using excel sheet and manually do a simple script to change their layers and stuffs once I already know the specific colors to get that is present in my model space. quick select is a good option to do it but I got a bunch of drawings and bunch of elements in one drawing and it's so tedious to do it manually like that. I am open to any other easier suggestions if there's any and thank you in advance for any help. Drawing1.dwg
-
Hey Guys, Its been a awhile since I have done any Autolisp programming and I am stuck... I am using a conditional statement to generate a number i.e. 1.625 and then I want to add that to the Z elevation of a point but it keep erroring out at this line. I have spent about an hour and half looking back thru resources and haven't been able to find the correct syntax. This is the line erroring out: (setq NEWPT1 (APPEND (LIST (CAR USRP1) (CADR USRP1)) (+ (CDDR USRP3) TRAP_Z_OFF))) ; ERRORS OUT HERE Here is the full code. (defun C:droptrap() (command "UNDO" "BEGIN") (initerr) (setvar "lunits" 2) (setvar "luprec" 4) (setvar "attreq" 0) (command "UNDO" "BEGIN") (setq OLDCMD (GETVAR "CMDECHO")) (setvar "CMDECHO" 0) (setq OLDOSMODE (GETVAR "OSMODE")) (setvar "OSMODE" 0) (setq OLDORTHOMODE (GETVAR "ORTHOMODE")) (vl-load-com) (setq thisdrawing (vla-get-activedocument (vlax-get-acad-object))) (initget "1 2 3 4") (setq TRAP_TYPE (getkword "\n Select trapeze type: ([1]:1-5/8x1-5/8, [2]:1-5/8x1-5/8 B2B, [3]1-5/8x13/16, [4]1-5/8x13/16 B2B): ")) (if (or (= TRAP_TYPE "1")(= TRAP_TYPE "3")) (progn (initget "1 2") (setq FACE_DIR (getkword "\n Trapeze opening up or down?: ([1]:UP [2]:Down): ")) ) (setq FACE_DIR "1") ) (cond ((and (= TRAP_TYPE "1")(= FACE_DIR "2")) (setq TRAP_Z_OFF 1.625)) ((and (= TRAP_TYPE "3")(= FACE_DIR "2")) (setq TRAP_Z_OFF 0.8125)) (T (setq TRAP_Z_OFF 0.0)) ) (setq blockname "TRAP-XDATA-T1_1.625") (setq USRP1 (GETPOINT "\n Select center point of rod 1: ")) (setq USRP2 (GETPOINT "\n Select center point of rod 2: ")) (setq USRP3 (getpoint "\n Select elevation of attachment point: ")) (setq NEWPT1 (APPEND (LIST (CAR USRP1) (CADR USRP1)) (+ (CDDR USRP3) TRAP_Z_OFF))) ; ERRORS OUT HERE (setq NEWPT2 (APPEND (LIST (CAR USRP2) (CADR USRP2)) (+ (CDDR USRP3) TRAP_Z_OFF))) ; ERRORS OUT HERE TOO (setq MIDPT (POLAR NEWPT1 (ANGLE NEWPT1 NEWPT2) (* (DISTANCE NEWPT1 NEWPT2) 0.5))) (setvar "ORTHOMODE" 1) (COMMAND "-INSERT" BLOCKNAME MIDPT "1" "1" NEWPT2) (command "rotate3d" (entlast) "" 2 NEWPT1 NEWPT2 90) (setvar "OSMODE" OLDOSMODE) (setvar "CMDECHO" OLDCMD) (setvar "CLAYER" LAYNAME) (COMMAND "UNDO" "END") (PRINC) ) The code is unfinished so I am trying to keep it working as I build it.
-
Hi everyone, I'm currently writing a C# plugin for AutoCAD. I have a form containing several buttons among other things. One minor function I would like to add is to open the Group Manager via my custom created button inside that form. Now my problem is I can't seem to figure out how to access or find that command. Any ideas how I can open the Group Manager by code? -Mike
-
- plugin
- group manager
-
(and 3 more)
Tagged with:
-
Bypassing dialog box when Opening a dynamic block as a drawing
Ahankhah posted a topic in AutoLISP, Visual LISP & DCL
Hi every body, when a dynamic block (exported via WBLOCK command as a drawing) is opened, AutoCAD shows a dialog announcing and asking: (The answer is Yes or No) Is it possible to bypass the dialog when opening the drawing from an AutoLISP code? I appreciate any help.