Search the Community
Showing results for tags 'getpoint'.
-
how can I change “GETPOINT” z-axis value? I need always z-axis value “0”. Because when I am taking with getpoint, one line distance if the line has z axis that also it will come to that length. Am drafting 2d I don’t want 3d. so when I will get the quantity it's coming wrong (defun c:test() (vl-load-com) (setq acadobj (vlax-get-acad-object) doc (vla-get-activedocument acadobj)) (setq pt1 (vla-getpoint (vla-get-utility doc) nil "\nPick 1st point for length") pt1v (vlax-variant-value pt1) pt1zv (vlax-safearray-get-element pt1v 2)) (vlax-safearray-put-element pt1v 2 100.00) (setq new-zvalue (vlax-safearray-get-element pt1v 2)) (setq pt2 (vla-getpoint (vla-get-utility doc) nil "\nPick 1st point for length") pt2v (vlax-variant-value pt2) pt2zv (vlax-safearray-get-element pt2v 2)) (vlax-safearray-put-element pt2v 2 100.00) (setq new-zvalue (vlax-safearray-get-element pt2v 2)) (entmake (list (cons 0 "line")(cons 8 "01-identity")(cons 10 pt1)(cons 11 pt2))))
-
I keep getting an error when I use getpoint. When I look at SPT or EPT it's nil (defun c:STUD15 (/ SPT EPT Wallth Ceilinghg) (setq SPT (getpoint "\nPick start of wall.....")) (setq EPT (getpoint "\nPick end of wall....."));at this point I get...error: bad argument type: 2D/3D point: nil (setq Wallth (distance spt ept));length of wall (setq Ceilinghgt 96.0) (setq UnflrBeamhgt (+ Ceilinghgt 0.5)); Can someone explain what I am doing wrong. Thanks
-
Get point of when there are no entities selected.
Lee Chu Chu posted a topic in AutoLISP, Visual LISP & DCL
I have this code: (setq PT1 (getpoint)) (setq PT2 (getpoint PT1)) (command "LINE" PT1 PT2) (command) (setq obj1 (entget (entlast))) (setq ent (car (nentsel "\nSelect Entity: \n"))) (cond ((/= ent nil) (setq obj2 (entget ent)) (command "chamfer" obj ent) ) ((= ent nil) (setq PT3 (getpoint ent)) (command "LINE" PT2 PT3) ) ) ) Its supposed to be able to draw a line when if there is no entity it draws the line up till that point where I tried to select the entity. However when I execute this code, it will state that I have an inappropriate data type. How should I modify the code to be able to draw the line from the last point to the point of which I tried to select an entity if an entity doesn't exist at that particular point? -
Say this is my code: (defun c:test() (setq list(getpoint "\nChoose point here") ) When you click on your autocad drawing i know that it stores the coordinates in a x,y,z format in a list.. How can i extract those numbers?
-
I'm running AutoCad Architecture 2013 on Win7 64bit. Installed VBA enabler for Acad2013 64bit version. When start the simple code below: Sub Example_GetPoint() Dim retPnt As Variant retPnt = ThisDrawing.Utility.GetPoint(, "Enter a point: ") ... ... ... ... End Sub It hangs up at "GetPoint". I can't switch to the AutoCAD window to select anything. The only way to get control back is to go to taskbar, right-click the AutoCAD icon and try to close it, then click cancel, I will get control back in VBA Editor. The same thing happens with "SelectOnScreen". But if I run this macro from Autocad directly, everything is fine. Does anyone have same experience or any advice? Thanks a lot.
-
User input: Getpoint OR real at the same time. Its possible?
Blur314 posted a topic in AutoLISP, Visual LISP & DCL
Hi everybody, First thing I want to apologize if something that I wrote sounds strange. Im spanish and my english is not as good as it should be=P. Im learling little by little autolisp things, mostly strugling through examples, codes, etc... many of them from this forum so I thank you a lot ^_^. At this moment I'm developing a routine that breaks/trims walls in order to insert doors or windows, and, after looking for it a few days, I would like to know if there's a way to use a number that users input on the command line (in a getpoint) without getting an error.,... wich is that happends everytime =/. ;; HOLE-O-MaTIC 2000 ;; by Arturo Blanco Ureña. 2013 ;; Breaks "walls" in order to insert windows or doors ;; Based initialy on code from Pavel Chour http://klobouk.fsv.cvut.cz/~chour/Lisp/Chapter%206.htm (defun error1 (errmsg) (command "_undo" "_end") (setvar "CMDECHO" 1) (setvar "OSMODE" osmodevar) (setq *error* temperr) (prompt "\nAchtung!!! Verboten!!! Error!!!\n") (princ) ) (defun c:holes(/ );P1a P2a P1 P2 P3 P4 A1 A2) (setq osmodevar (getvar 'OSMODE) temperr *error* *error* error1 ) (if (not ancho) (setq ancho 1.50)) (setq Tancho (rtos ancho) P1 "Width" ) (setvar "CMDECHO" 0) (command "_undo" "_begin") (setvar "osmode" 512) ;I'm using this structure in order to go back to the menu so I can change my mind several times. ;Don't know if there's a better way =P. ;--- (while (= P1 "Width") (initget 128) (setq P1 (getpoint (strcat "\nSelect Point or [Center/Width]<" Tancho ">:"))) (cond ((numberp P1) (setq ancho P1) ;trying to recognice P1 as a number but always goes on error =/ (setq Tancho (rtos ancho)) );cond1 ((= P1 "Width")(setvar "osmode" 35) (setq ancho (getdist "\nWidth of the Door/window?:")) (setq Tancho (rtos ancho)) );cond2 );end cond );end while ;--- (cond ((= P1 "Center") (setvar "OSMODE" 518) ;If the user want to break from the center of the window. (setq P1a (getpoint (strcat "\nSelect center <" Tancho ">:"))) (setvar "OSMODE" 128) (setq P2a (getpoint P1a "\nSelect the other side of the wall:") A1 (angle P1a P2a) A2 (+ (* pi 1.5) A1) P1 (polar P1a A2 (* ancho 0.5)) P3 (polar P1a A2 (* ancho -0.5)) P2 (polar P2a A2 (* ancho 0.5)) P4 (polar P2a A2 (* ancho -0.5)) ) );end cond1 (T (setvar "osmode" 128) ;if he/she wants to start from one side (setq P2 (getpoint P1 "\nSelect the other side of the wall:")) (setvar "osmode" 512) (setq A1 (angle P1 P2) A2 (+ (* pi 1.5) A1) P3 (polar P1 A2 ancho) P4 (polar P2 A2 ancho) P1a (polar P1 A2 (* ancho 0.5)) P2a (polar P2 A2 (* ancho 0.5)) ) );end else );end cond (setvar "osmode" 512) (command "_break" P1 P3 "_break" P2 P4 "_line" P1 P2 "") (setq L1 (entlast)) (command "_line" P3 P4 "") (setq L2 (entlast)) ;I add this in order to trim extra lines in the middle of the wall. (command "_trim" L1 L2 "" "B" P1a P2a "" "") (command "_undo" "_end") (setvar "CMDECHO" 1) (setvar "OSMODE" osmodevar) (setq *error* temperr) (princ) );end As you see You can enter the "Width" to give it, but I would like to simply write down a number when asking for a point, recognize that is a number and use it as the value of the variant. If a point is entered, then continue normally. Im a bit shy and its the first time i post a code. I have used several pieces of code from others to arrange the error handling/undo and its originally based on one tutorial from Pavel Chour, so I dont know if its right that I give permission or not to use it, or even its worth it (the trim still fails and i dont really get why ) but If anyone want to use it feel free. Any tips critics and opinions are welcome also -
one point relative to another for starting text
clint0577 posted a topic in AutoLISP, Visual LISP & DCL
In this lisp I'm trying to replace 4 blocks that pretty much do the same thing. I want the user to Click the point they want to use for the center of the text and the have the code calculate a certain distance, say 3.5 below on the Y axis for the next line of text. ;INSERT STREET NAME & R.O.W. (DEFUN C:STRN () (SETQ CL (GETVAR "CLAYER")) (command ".osnap" "NONE") (setq DS (getvar 'dimscale)) (SETQ SNTW (* DS 3)) (SETQ RWTW (* DS 1.5)) (SETQ SHS (* DS 0.13)) (setq pt1 (getpoint "\nPick insertion point for Street Name : ")) (setq sn (getstring t "\nType the Street Name: ")) (setq sr (getstring t "\nType the Right Of Way Enter VW for Variable Width or P for Public: ")) (SETQ SRW (STRCAT SR "' R.O.W.")) (COMMAND "LAYER" "S" "STREET_NAME" "") (COMMAND "MTEXT" "_non" pt1 "J" "BC" "S" "STANDARD" "H" SHS "W" SNTW sn "") (SETQ RHS (* DS 0.08)) (SETVAR "CECOLOR" "140") (COMMAND "MTEXT" PAUSE "J" "BC" "S" "STANDARD" "H" RHS "W" RWTW sRW "") (SETVAR "CECOLOR" "BYLAYER") (COMMAND "CLAYER" CL) (command ".osnap" "NOD,end,INT,CEN,mid") (setq OldTxt "VW' R.O.W.") (SETQ vwrw (STRCAT "VARIABLE WIDTH R.O.W.")) (setq ss (ssget "x" '((0 . "TEXT,MTEXT")))) (setq i (sslength ss)) (while (not (minusp (setq i (1- i)))) (setq oText (vlax-ename->vla-object (ssname ss i))) (setq Txt (vlax-get-property oText 'TextString)) (if (vl-string-search OldTxt txt) (progn (setq newChg (vl-string-subst VWRW OldTxt txt)) (vlax-put-property oText 'TextString newchg) (vlax-invoke-method oText 'Update) ) ) ) (setq P "P' R.O.W.") (SETQ PRW (STRCAT "PUBLIC R.O.W.")) (setq ss (ssget "x" '((0 . "TEXT,MTEXT")))) (setq i (sslength ss)) (while (not (minusp (setq i (1- i)))) (setq oText (vlax-ename->vla-object (ssname ss i))) (setq Txt (vlax-get-property oText 'TextString)) (if (vl-string-search P txt) (progn (setq newChg (vl-string-subst PRW P txt)) (vlax-put-property oText 'TextString newchg) (vlax-invoke-method oText 'Update) ) ) ) ) -
Error: bad argument type - Sum getPoint with getInt variable.
cyberrog posted a topic in AutoLISP, Visual LISP & DCL
Hello, I'm building a lisp to add new text based on a standard distance givven by the user. The lisp is: (defun c:myFunction() (setq point (getpoint "Click on start point :")) (setq qtd (getint "\nQuantity of blocks :")) (setq dist (getint "\nDistance :")) (setq x 0 y 0 q 0) (setq pp point) (setq x (car pp)) (while (< q qtd) (setq Text (getstring "Text :")) (command "text" pp "2" "0" Text ) (setq x (+ pp dist)) (setq q (+ q 1)) ) ) But when it asks the Text to be entered, I type it but the following error shows up. error: bad argument type (+ PP DIST) (SETQ X (+ PP DIST)) I think its the type of dist and pp, because one is getint and other is getpoint.