Search the Community
Showing results for tags 'activex'.
Found 3 results
addmleader ends up on Z 0
Herr_Manu posted a topic in AutoLISP, Visual LISP & DCLHi everyone I'm trying to create a mleader to properly label the properties of some Plant 3D components, but i'm having some problems to set elevation of the mleader, given that mleader don't have an "elevation" Property to use vla-put. So far i tried with (trans p1 0 1) (trans p2 0 1) but everything ends up in the correct x and y coordinates but in z 0 (defun mleader (text) (if (and (setq p1 (getpoint "\nPick First Point: ")) (setq p2 (getpoint "\nPick Next Point: " p1)) ) (progn (setq obj (vlax-invoke (vlax-get (vla-get-ActiveDocument (vlax-get-acad-object)) (if (= 1 (getvar 'CVPORT)) 'PaperSpace 'ModelSpace );if );end of vlax 'AddMLeader (append p1 p2) 0 );end invoke );end setq obj (vla-put-textstring obj text) (vla-put-TextHeight obj 50) (vla-put-TextWidth obj 1300) );end of progn );end if (princ) );end defun mleader I'm looking forward to read the comments about this regard. i'm sure it will be really useful BTW, does anyone know why 'AddMleader after (append p1 p2) needs this extra 0 ???? Thanks a lot
Zoom From Viewport via ActiveX
Grrr posted a topic in AutoLISP, Visual LISP & DCLHey guys, So I have a block reference in ModelSpace, and a Viewport located on a Layout with 5-6 other viewports. I was trying to write a subfunction that would zoom that certain viewport to the bounding box's of that block reference. I've never dealt with VIEWPORTS, So I currently assembled this sub, from @rlx's code which works as I've expected: ; Currently using this : ; (ViewportZoomToBlockReference "header" (vlax-ename->vla-object (car (entsel)))) (defun ViewportZoomToBlockReference ( BlockRefName VportObj / BlockRefName oldcmdecho vplist curcvport nr vpss ms en x SS blk ll ur ) (cond ( (not (tblsearch "BLOCK" BlockRefName)) (princ (strcat "\nUnable to find " BlockRefName " block definition")) ) ( (not ( (lambda ( / ctab ) (setq ctab (getvar 'ctab)) (setvar 'ctab "Model") (setq SS (ssget "_X" (list (cons 0 "INSERT") (cons 2 BlockRefName) (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model"))))) (setvar 'ctab ctab) SS ); lambda ) ) (princ (strcat "\nUnable to obtain selection for " BlockRefName " blocks")) ) ( (not (setq blk (vlax-ename->vla-object (ssname SS 0)))) ) (t (setq oldcmdecho (getvar "cmdecho"))(setvar "cmdecho" 0)(setq vplist (mapcar 'car (vports)))(setq curcvport (getvar "cvport")) (if (= (getvar "tilemode") 0) (progn (if (= (setq ms (getvar "cvport")) 1)(command "._mspace")) (setq nr 0 vpss (ssget "_x" (list '(-4 . "<AND") '(0 . "VIEWPORT")(cons 410 (getvar "ctab")) '(-4 . "<NOT") '(69 . 1) '(-4 . "NOT>") '(-4 . "AND>")))) (setq en (entget (vlax-vla-object->ename VportObj))) (if (and (= 0 (logand 1 (cdr (assoc 90 en))))(< 0 (cdr (assoc 68 en)))(/= 16384 (logand 16384 (cdr (assoc 90 en))))) (progn (setvar "cvport" (cdr (assoc 69 en))) (vla-GetBoundingBox blk 'll 'ur) (vla-ZoomWindow (vlax-get-acad-object) ll ur) ) ) (if (= ms 1) (command "._pspace")) ) ; (foreach x vplist (setvar "cvport" x) (command "._zoom" "_e")) ) (setq vpss nil)(setvar "cvport" curcvport)(setvar "cmdecho" oldcmdecho) ); t ); cond ); ViewportZoomToBlockReference Problem is that it uses command calls, and I need to use this sub for 3-4 different viewports (for 'header', 'footer', 'side-legend', 'main-window') on like 100 layouts and the whole thing becomes very sloow... So right now I'm trying to figure out how to 'activate' that certain viewport, zoom to the BoundingBox, and 'deactivate' it, with ActiveX. BTW I've checked out this regarding viewport activation/deactivation, but unfortunately doesn't work for me (upon 'manual' testing).
Trudy posted a topic in AutoLISP, Visual LISP & DCLHello everyone, sorry if my question is stupid but i dont understands how it work. I want to ask after "(vlax-dump-object obj T)" and find all methods. ; Methods supported: ; AddPointMultiple (1) ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; CreateSnapshot () ; Delete () ; ExtractBorder (1) ; ExtractContour (4) ; FindElevationAtXY (2) ; GetBoundingBox (2) .................................... others. In my case i dump Tin surface. Question is how can i use them, i found for this (setq contours (vlax-invoke-method obj 'FindElevationAtXY X Y)) (setq something (vlax-invoke-method obj 'ExtractContour ? ? ? ?)) if i understand right i need 4 parameters but dont know where to find them. Where or how i can see for each method what is the parameter. My goal is to extract grid lines from surfaces. Thank you