Search the Community
Showing results for tags 'vla'.
Found 3 results
this is probably super simple but can't find the answer: (setq apr (vlax-ename->vla-object (entlast)));#<VLA-OBJECT IAcadRegion 000002c2d9920cb8> (vla-put-Normal apr '(0.0 0.0 1.0)); error: ActiveX Server returned an error: Type mismatch (vla-Update apr)
tmelancon posted a topic in AutoLISP, Visual LISP & DCLHello, I currently use a routine that offsets a line in both directions based on a specified distance in the routine. After we run the command we usually have to select the two offset lines and put them on a specific layer, in this case "Structure". I am trying to just add to the routine so the offset lines are automatically put on that layer for us but for some reason when we run the routine its putting all 3 lines (the original, and the two offset lines) on that layer. Can someone review it over and respond. Thanks (defun C:OFF (/ pickEnt pickObj offDist) (vl-load-com) (setq offDist 0.0812) (while (setq pickEnt (entsel)) (cond ((and pickEnt (setq pickObj (vlax-EName->vla-Object (car pickEnt))) offDist) (vla-put-layer pickObj "STRUCTURE" ) (vla-Offset pickObj offDist) (vla-Offset pickObj (- offDist)) ) ) ;_ end of cond ) ;_ end of while (princ) ) ;_ end of defun
I currently have a really really basic LISP routine. It was written to center a group of objects within a 12x9 drawing sheet (some people do not care whether their drawing is centered or not... pet peeve) ANYWAYS.. In a nutshell it prompts user to select objects using SSGET. Then asks the user for 2 points, which could be any two opposing points that encompass the outer most limits of the group of objects. After the SSGET and the 2 points have been established I have the routine moving the group based on center of 2 points to the center of the 12x9 drawing sheet. We draw in isometric hence the command snap "I" and "S". I had it snap to Standard so the beginner users can quickly move their cursor to the extents of any given group.. See Code below (DEFUN C:CEN (/ *ERROR* oldsnap oldos) (defun *error* (msg) (if oldos (setvar "osmode" oldos)) (if oldsnap (setvar "snapmode" oldsnap)) (if msg (prompt msg)) (princ) ) (setvar "cmdecho" 0) (setq oldsnap (getvar "snapmode") (setq oldos (getvar "osmode")) (princ "\nSelect Object(s) to CENTER within the titleblock. ") (SETQ CENT3R (SSGET )) (command "snap" "s" "s" "") (setvar "snapmode" 0) (SETQ P1 (GETpoint "\nFirst corner of rectangle: ")) (setvar "osmode" 0) (setq p2 (getCORNER P1 "\nSecond corner of rectangle: ")) (COMMAND "MOVE" CENT3R "" "m2p" p1 p2 "M2P" "0,0" "12,9") (command "snap" "s" "i" "") (setvar "snapmode" oldsnap) (setvar "OSMODE" OLDOS) (SETQ CENT3R NIL) (*ERROR* NIL) (PRINT) ) I would like to use BoundingBox function to Automatically get the coordinates of the SSGET, instead of asking user for First and Second points of rectangle. See Code below that gets bounding box coordinates. Can someone please help me bring these 2 together? Thanks and God bless. (defun c:test ( / OBJ Point1 Point2 ) (vl-load-com) (princ "\nSelect an object: ") (setq OBJ (vlax-ename->vla-object (ssname (ssget) 0))) (if OBJ (progn ;;OBJ is a vla-object ;;Point1 is the lower left point of the bounding box around the object ;;Point2 is the upper right point of the bounding box around the object (vla-getboundingbox OBJ 'Point1 'Point2) ;;Point1 and Point2 are returned as a safearray and need to be converted to a list (setq Point1 (vlax-safearray->list Point1)) (setq Point2 (vlax-safearray->list Point2)) (princ (strcat "\n The lower left corner is " (rtos (car Point1) 2 2) ", " (rtos (cadr Point1) 2 2))) (princ (strcat "\nThe upper right corner is " (rtos (car Point2) 2 2) ", " (rtos (cadr Point2) 2 2))) ) ) (princ) )