Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. I wonder if their is a Z difference that those commands error. many a "2D" Drawing iv been given has stuff like 100' above everything else.
  3. Today
  4. pkenewell

    leader and mtext are not attaching

    @pmadhwal7 Looks like you had this same problem in 2019. MLEADERS were suggested to you then and you didn't try the tools offered? I did the following with a LEADER to MLEADER conversion very quickly:
  5. 100% setenv is writing strings to your windows registry. not good if you are doing that for all variables. might want to check to see what else you have been writing there. HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R##.#\ACAD-####:###\Profiles\<<Unnamed Profile>>\Variables tho setenv will persist even after reboot. overkill for most variables need in lisp. like @pkenewell said you should be good with just global variables. that holds while the drawing is open but make them unique. if you need to hold a variable in the drawing itself. use ldata that will persist in the drawing. so you can close and reopen it.
  6. Or using the method proposed by @Stefan BMR we could automate in lisp like this: (enter the distances when the cursor is on the tracking line to get the desired angles) (defun des_vec (lst col / lst_sg) (setq lst_sg (list (cadr lst) (car lst))) (setq lst (cdr lst)) (while lst (if (cadr lst) (setq lst_sg (cons (cadr lst) (cons (car lst) lst_sg))) ) (setq lst (cdr lst)) ) (setq lst_sg (cons col lst_sg)) (grvecs lst_sg) ) (defun c:pl90-45 ( / old_set p1 p2 lst_pt msg) (setq old_set (mapcar 'getvar '("GRIDMODE" "ANGDIR" "ANGBASE" "POLARANG" "POLARMODE" "AUTOSNAP" "SNAPANG" "ORTHOMODE"))) (initget 33) (setq p1 (getpoint "\nPick start point: ")) (initget 33) (setq p2 (getpoint p1 "\nReference start angle: ") lst_pt (list (list (car p1) (cadr p1))) msg "\nGive distanve in the direction of cursor: " ) (mapcar 'setvar '("GRIDMODE" "ANGDIR" "ANGBASE" "POLARANG" "POLARMODE" "AUTOSNAP" "SNAPANG" "ORTHOMODE") (list 0 0 (angle p1 p2) (* 0.25 pi) 3 2 (angle p1 p2) 1) ) (initget 303) (while (and (setq p2 (getpoint p1 msg)) (/= p2 "C")) (cond ((/= p2 "U") (setq p2 (list (car p2) (cadr p2))) (mapcar 'setvar '("AUTOSNAP" "SNAPANG" "ORTHOMODE") (list 10 (angle p1 p2) 0) ) (setq p1 p2 lst_pt (cons p2 lst_pt) msg "\nGive distanve in the direction of cursor or [C/U] for Close or Undo : " ) ) (T (setq lst_pt (cdr lst_pt) p1 (car lst_pt) ) ) ) (redraw) (des_vec lst_pt 7) (initget 302 "C U") ) (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 8 (getvar "CLAYER")) '(100 . "AcDbPolyline") (cons 90 (length lst_pt)) (if (= p2 "C") '(70 . 1) '(70 . 0)) ) (mapcar '(lambda (x) (cons 10 x)) lst_pt) ) ) (mapcar 'setvar '("GRIDMODE" "ANGDIR" "ANGBASE" "POLARANG" "POLARMODE" "AUTOSNAP" "SNAPANG" "ORTHOMODE") old_set) (prin1) )
  7. pmadhwal7

    leader and mtext are not attaching

    @pkenewellthis is the actual file i was attached after that we rotate it and make it like seen in screenshot, leader and text are zero digree roation the curret leader text are easy to move and rotate so we use those if u have any other method kindly shre
  8. pkenewell

    leader and mtext are not attaching

    Yes - I checked you file, but the first time, I just used my convert to MLEADER program and successfully did ALL the annotations. Going back into it now, I see the the QLATTACH and QLATTACHSET is not working for every leader. I can't explain why sorry. There is no error message on some - it just does not do it.
  9. pmadhwal7

    leader and mtext are not attaching

    @pkenewellsir did u check my file?
  10. pkenewell

    leader and mtext are not attaching

    @pmadhwal7 You cannot attach the text to standard LEADER objects so they move together. They would at least have to be converted to QLEADERS. MLEADERS are better. I convert all my old leaders to MLEADERS using a similar program, so that the text stays with the leader. PS: The express tools "Annotation Attachment > Attach Leader to Annotation" works with the older leaders like @mhupp said, using reactors (Makes it a QLEADER effectively). However, to move the leader, you always have to move the TEXT first. If you move the leader end point near the text first, the text will stay where it is. That's why MLEADERS are better!
  11. pmadhwal7

    leader and mtext are not attaching

    no through global attached leader commond those types of leader text not join i tried that too
  12. hi i use this code to insert block in zwcad. this is part of bigger code ;; Calculate scale factor based on distance from mid1 to mid2 (setq scaleFactor (distance mid1 mid2)) ;; Block options (defun _eArt67 () (setq blkn "C:\\blocks\\eArt67.dwg") (if (and mid1 mid2) (progn (setq scl (distance mid1 mid2) ang (angle mid1 mid2)) (if (setq ins mid1) (command "._-insert" blkn "_non" ins scaleFactor "" (angtos (+ (/ pi 2) ang))) ) ) ) ) i find this code and i like the part mirror the block using [TAB]. (defun C:test ;| credits to: Lee Mac |; ( / *error* cm SelBname bn p Blk ll ur msg SS cen Grrr mc ) (defun *error* (m) (redraw)(and cm (setvar 'cmdecho cm)) (and m (print m)) (princ)) (defun SelBname ( / e bn ) (setvar 'errno 0) (while (/= 52 (getvar 'errno)) (setq e (car (entsel "\nSelect block to reinsert <exit>: "))) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") (setvar 'errno 0) ) ( (and (= 'ENAME (type e)) (/= (cdr (assoc 0 (entget e))) "INSERT")) (princ "\nThis is not a block.") (setq e nil) ) ( (and e (not (alert "Visit lee-mac.com")) (setq bn (vla-get-EffectiveName (vlax-ename->vla-object e))) (setvar 'errno 52)) ) ); cond ); while bn ); defun SelBname (redraw) (setq bn (SelBname)) (while (and (setq cm (getvar 'cmdecho)) (setvar 'cmdecho 0) bn (last (setq p (list (getpoint "\nSpecify insertion point <exit>: ")))) (last (setq p (append p (list (getpoint (last p) "\nSpecify second point <exit>: "))))) (not (apply 'grdraw (append p (list 1 7)))) (setq Blk (vla-InsertBlock (vlax-get-property (vla-get-ActiveDocument (vlax-get-acad-object)) (if (= 1 (getvar 'CVPORT)) 'Paperspace 'Modelspace) ) ; AcSpc (vlax-3D-point (car p)) bn 1. 1. 1. 0. ) ) ) (progn (vla-GetBoundingBox Blk 'll 'ur) (vla-ScaleEntity Blk (vlax-3D-point (car p)) (/ (apply 'distance p) (abs (apply '- (mapcar 'car (mapcar 'vlax-safearray->list (list ll ur))))) ) ) (vla-put-Rotation Blk (apply 'angle p)) (setq msg "\nPress [TAB] to change orientation, [ENTER] to exit: ") (and msg (princ msg)) (setvar 'errno 0) (setq SS (ssadd)) (ssadd (handent (vla-get-Handle Blk)) SS) (setq cen (apply 'mapcar (cons '(lambda (a b) (/ (+ a b) 2.)) p))) (while (/= 52 (getvar 'errno)) (setq Grrr (grread T)) (cond ((= (car Grrr) 2) (cond ((= (cadr Grrr) (ascii "\t")) (and msg (princ msg)) (and (not mc) (setq mc 0)) (setq mc (rem (+ mc 1) 4)) (cond ( (or (= mc 1) (= mc 3) ) (command "_.MIRROR" SS "" "_non" cen "_non" (polar cen (+ (apply 'angle p) (/ PI 2.)) (apply 'distance p)) "_Y") ) ( (or (= mc 2) (= mc 0) ) (command "_.MIRROR" SS "" "_non" cen "_non" (polar cen (apply 'angle p) (apply 'distance p)) "_Y") ) ) ) ((= (cadr Grrr) (ascii "\r")) (princ "\nExiting.") (redraw) (setvar 'errno 52) ) ); cond ) ((= (car Grrr) 25) (princ "\nExiting.") (redraw) (setvar 'errno 52) ) ); cond ); while ); progn ); while/if (and cm (setvar 'cmdecho cm)) (princ) );| defun |; (vl-load-com) (princ) Is it possible to add this part to the first code? Thanks
  13. @ScottMC I don't see the purpose of why you are cutting the circle, printing the coordinates to the command line, then pasting the circle in the same loop? - You don't need to initialize the pp variable as "" - There is not apparent reason to cut and paste the circle. - You do not need to put a Global variable into the registry to recall it again in the same session, even if the program stops. Try out the following code: (defun c:C2 (/ cr el *error* fp oe os p p2) (defun *error* (msg) (if oe (setvar "cmdecho" oe)) (if os (setvar "osmode" os)) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (princ (strcat "\n" msg)) ) (vla-startundomark (vla-get-activedocument (vlax-get-acad-object))) (setq oe (getvar "cmdecho") os (getvar "osmode") ) (setvar "cmdecho" 0) (while (and (setvar 'osmode (boole 7 os 512)) (setq fp (getpoint "\nSpecify 1st Point of 2P.Circle: ")) ) (command "._Circle" "_2P" "_non" fp) (setvar "osmode" OS) (princ "\nSecond Point: ") (while (= (logand (getvar "cmdactive") 1) 1) (command pause) ) (setq el (entget (entlast)) p (trans (cdr (assoc 10 el)) (cdr (assoc 210 el)) 1) p2 (getvar "lastpoint") cr (getvar "circlerad") ) (princ (strcat "\n Coordinates: " (setq C2:pp ;; Global Variable "C2:pp" (strcat (rtos (car p) 2 4) "," (rtos (cadr p) 2 4) "," (rtos (caddr p) 2 4) ) ) "\n Diameter: " (rtos (* cr 2) 2 4) "| Radius: " (rtos cr 2 4) "\n" ) ) (entmakex (list (cons 0 "POINT") (cons 10 p))) (entmakex (list (cons 0 "POINT") (cons 10 p2))) ) (setvar "cmdecho" oe) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (princ) )
  14. I'll give you a hint its in the 2nd Reply. no lisp code needed just express tool.
  15. ryanatkins49056

    Understanding 'Getenv Variable call denied'?

    So these were the results that I got from the command line Command: C CIRCLE Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: 2P Specify first end point of circle's diameter: !pp "50,60,0" <--------------- CALLING THE VARIABLE WORKS LIKE YOURS Specify second end point of circle's diameter: Command: C2 2.Point Circle (M) <'CT for.tan !pp> Specify 1st Point of 2P.Circle: !pp Can't reenter LISP. Invalid point. <--------------- CALLING THE VARIABLE DOESN'T WORKS LIKE YOURS *Cancel* Above the line that says invalid point you'll see it mentioned how you can't re-enter lisp. This means that if you wish to feed an autolisp variable into a custom autolisp coded command you can't feed it in like a regular command. I would hazard a guess the other issue is (if i'm reading it correctly) is that the variable is actually a string but the autolisp interpreter is expecting a list. I'm working on a few solutions in between work breaks (I am also in the Asia Pacific as well so its nearly bed time). But to proceed further if I may ask why are you writing the variable to the windows registry with the SETENV function?
  16. pmadhwal7

    leader and mtext are not attaching

    THIS CODE CONVERTING LEADER TO MLEADER AND I DIN'T REQUIRED MLEADER
  17. Just found out that 'my program' refuses transparent use of a variable saved. This happens only when trying to use a saved variable when it's 'my program'. The variable is unrecognized: Example.. Command: c2 2.Point Circle (M) <'CT for.tan !pp> Specify 1st Point of 2P.Circle: !pp Invalid 2D point. /\ <- keyed variable call --------------------------------------- Here's the original reply.. Command: c CIRCLE Specify center point for circle or [3P/2P/Ttr (tan tan radius)]: 2p Specify first end point of circle's diameter: !pp "39.5838,25.6142,0" <--------------- call /\ works the /\ contents are actually without parenthesis but appear as shown. Command: (princ (getenv "pp")) 39.5838,25.6142,0"39.5838,25.6142,0" How can the code be changed to allow [ !pp ]? Also tested this by making a base command (no extras) and the results are the same. (defun c:c2 ( / *error* p oldsnap 1st) ;just 2 point.. //wasCIRCLE TANGENT RE: 19SEPT17 (princ "\n 2.Point Circle (M) <'CT for.tan !pp> ") (setq pp "") (setq oldsnap (getvar 'osmode)) (setvar 'osmode (boole 7 (getvar 'osmode) 512)) ;; added 'nea for 1st point (defun *error* ( msg ) (setvar 'cmdecho 0) ;; 5.28.24 (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (setvar 'osmode oldsnap) (if msg (prompt (strcat "\n" msg))) (if (eq pp "") (setq pp (getenv "pp"))) ;; restores stored <!pp> from "pp" if crash (setvar 'cmdecho 1) (princ) ) (initget 103) (princ "\n Specify 1st Point of 2P.Circle: ") ;; (rtos (getvar 'circlerad))">" ;; <- not needed (setvar 'cmdecho 0) (while T ;; 'M' loop.. (setq 1st (getpoint)) ;; get 1st edge of '2p.cir (command ".circle" "2p" 1st) (setvar 'cmdecho 1) (while (= 1 (logand 1 (getvar 'cmdactive))) (setvar 'osmode (boole 7 (getvar 'osmode) 128)) ;(setvar 'osmode 128) ;; added 'perp (command "\\") ) (setq p2 (getvar 'lastpoint)) (setq p (trans (cdr (assoc 10 (entget (entlast)))) (cdr (assoc 210 (entget (entlast)))) 1)) ;; 210 for 'z' direction (vl-cmdf "_copybase" '(0 0 0) "_L" "" "_erase" "_L" "") ;; same as in: cut-... [ `` ] (setvar 'osmode oldsnap) (setvar 'cmdecho 0) ; (princ ; (setq pp ;; make/prints coords & paste usable ; (strcat ; (rtos (car p2) 2 4) "," ;; 'p' -- vertex from pgm /\ getpoint,... ; (rtos (cadr p2) 2 4) "," ; (rtos (caddr p2) 2 4) ; ) ; ) ; ) (princ "\n") (princ (setq pp ;; make/prints coords & paste usable (strcat (rtos (car p) 2 4) "," ;; 'p' -- vertex from pgm /\ getpoint,... (rtos (cadr p) 2 4) "," (rtos (caddr p) 2 4) ) ) ) (princ (strcat " | Ø: " (rtos (* (getvar 'circlerad) 2) 2 4)" | R: " (rtos (getvar 'circlerad) 2 4))) (entmakex (list (cons 0 "POINT") (cons 10 p))) ;; clean point (entmakex (list (cons 0 "POINT") (cons 10 p2))) ;; clean point (command "_pasteclip" '(0 0 0)) ;; restore circle [now 'last.obj] (princ "\n Specify 1st Point of 2P.Circle: ") ;; (rtos (getvar 'circlerad))">" (setenv "pp" pp) (setvar 'osmode oldsnap) ) ;; end of while (setvar 'cmdecho 1) (*error* nil) (princ) ) Same function but not from a home.made cmd.
  18. Yesterday
  19. Inside lisp programs the "\" backslash has a special meaning so I would suggest you consider using a different character, it makes the programming much easier, maybe use any other character like @ # $ ^ or the | "pipe" above "\". An example is "\n" is a new line. a "\\" returns a single "\". You can use A-Z, or a-z note z is a easy key to press. Yes 52 characters not 26 from a programming aspect but either can be used as you can force upper or lower case. You may also want some more options 30 & 60 degrees, a 2pt X&Y option and so on.
  20. first thing on google.
  21. Hello, I’m a beginner in creating dynamic blocks. I need to create dynamic blocks for electrical schematics. They should contain a symbol and three attributes. The symbol should be able to rotate as needed, while the text attributes should remain horizontal and change position to stay visible. Also, perhaps the most important requirement is that the attributes change alignment (left/right) depending on the rotation angle. Here is an image of what I have managed to create and what I actually need. I am also attaching a DWG file. If anyone can download and take a look, maybe I’m already heading in the right direction. Thank you very much in advance. DynamicBlockSymbol.dwg
  22. i was facing issue when i was associating leader with m-text some of are associting but too many are not i was try it too many time but not got the result, my screeshot and dwg are attached pls if anyone help me this is very crucial and important task for me leader.dwg
  23. At least old information is still available for now, Cadalyst is pretty much gone, might find something with Wayback, several others over the years have gone the way of the Dodo.
  24. fixed an error with substr to only remove the first char of the string. and added your + option.
  25. I've been using already THANKS. I promise this might be my last change. Can you add +distsance just extend the last line that additional amount?
  26. I was using /# and /-# but using / and \ works to. if the 45 still going the wrong way you just need to flip the first two wcmatch calls. right now line 17 ((wcmatch inp "\\*") line 26 ((wcmatch inp "/*") fix line 17 ((wcmatch inp "/*") line 26 ((wcmatch inp "\\*") PolyHouse.lsp
  27. One more thing. If osnap is on it will snap to that object if the line lands on it. Can you automatically turn off osnap at the beginning?
  28. Not sure how much longer I need admin's approval for my new posts (I totally understand).... Couple of requests....... Can you change - sign to be for a 90° left turn and nothing would be 90° right? And reverse the / and \ so that / is a 45° to the right and \ is a 45° to the left? Currently \ does not seem to working properly. Other than that you ROCK. As far as coding in notepad I personally would not use it. My goal is to just 10-key for inputs.
  1. Load more activity
×
×
  • Create New...