Jump to content

Leaderboard

  1. GLAVCVS

    GLAVCVS

    Community Member


    • Points

      4

    • Posts

      672


  2. Lee Mac

    Lee Mac

    Trusted Member


    • Points

      3

    • Posts

      21,014


  3. ronjonp

    ronjonp

    Trusted Member


    • Points

      3

    • Posts

      2,524


  4. Tomislav

    Tomislav

    Community Member


    • Points

      2

    • Posts

      208


Popular Content

Showing content with the highest reputation on 03/27/2025 in Posts

  1. Use entmakex. ; A 1000x500 rectangle with horizontal sides with a global width of 40, vertical sides with a global width of 0. (defun c:RectWidth-hor40 (/ pt1 pt2 hWidth vWidth p1 p2 p3 p4 pl) (setq width 1000 ; Rectangle width height 500 ; Rectangle height hWidth 40 ; Global width of horizontal sides vWidth 0) ; Global width of vertical sides (setq pt1 (getpoint "\nSpecify the insertion point: ")) (setq p1 pt1 p2 (list (+ (car pt1) width) (cadr pt1)) p3 (list (+ (car pt1) width) (+ (cadr pt1) height)) p4 (list (car pt1) (+ (cadr pt1) height))) (setq pl (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1) (cons 10 p1) (cons 40 hWidth) (cons 41 hWidth) (cons 10 p2) (cons 40 vWidth) (cons 41 vWidth) (cons 10 p3) (cons 40 hWidth) (cons 41 hWidth) (cons 10 p4) (cons 40 vWidth) (cons 41 vWidth) ) ) ) (princ) )
    2 points
  2. solved it, instead of pt I put '(0.0 0.0 0.0) and it works.(pt and r are acquired at start of lisp) THANX again for ur help and guidance, and @Tharwat for his lisp that gave me idea
    2 points
  3. @Nikon It's also good practice to retrieve variables before changing them. ;; Change this (setq vwidth 0) ;; To this (setq vwidth (getvar 'plinewid))
    1 point
  4. Exactly. Why don't you use a block for this? (defun c:foo (/ p) (cond ((null (tblobjname "block" "FOO")) (entmake '((0 . "BLOCK") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockReference") (2 . "FOO") (10 0. 0. 0.) (70 . 0) ) ) (entmake '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (67 . 0) (8 . "L-MVIEW") (100 . "AcDbPolyline") (90 . 4) (70 . 129) (38 . 0.) (39 . 0.) (10 1000. 0.) (40 . 0.) (41 . 0.) (42 . 0.) (91 . 0) (10 1000. 500.) (40 . 40.) (41 . 40.) (42 . 0.) (91 . 0) (10 0. 500.) (40 . 0.) (41 . 0.) (42 . 0.) (91 . 0) (10 0. 0.) (40 . 40.) (41 . 40.) (42 . 0.) (91 . 0) ) ) (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) ) ) (while (setq p (getpoint "\\nPick a point: ")) (entmakex (list '(0 . "INSERT") '(2 . "FOO") (cons 10 p))) ) (princ) )
    1 point
  5. This is the easiest way to do it, taking advantage of your code (defun c:RectWidth-hor40 (/ pt1 pt2 hWidth vWidth p1 p2 p3 p4 cj) (setq width 1000 ; Rectangle width height 500 ; Rectangle height hWidth 40 ; Global width of horizontal sides vWidth 0) ; Global width of vertical sides (setq pt1 (getpoint "\nSpecify the insertion point: ")) (setq p1 pt1 p2 (list (+ (car pt1) width) (cadr pt1)) p3 (list (+ (car pt1) width) (+ (cadr pt1) height)) p4 (list (car pt1) (+ (cadr pt1) height))) (setvar 'PLINEWID hWidth) (setq cj (ssadd)) (command "_.PLINE" p1 p2 "") (ssadd (entlast) cj) (command "_.PLINE" p3 p4 "") (ssadd (entlast) cj) (setvar 'PLINEWID vWidth) (command "_.PLINE" (list (car p1) (cadr p1)) (list (car p1) (+ (cadr p1) height)) "") (ssadd (entlast) cj) (command "_.PLINE" (list (car p2) (cadr p2)) (list (car p2) (+ (cadr p2) height)) "") (ssadd (entlast) cj) (command "_pedit" "_m" cj "" "_j" 0 "") (princ) )
    1 point
  6. @Nikon Use the JOIN command. Code is not needed.
    1 point
  7. (command "_pedit" "_m" (ssget) "" "_j" 0 "")
    1 point
  8. https://www.cadtutor.net/forum/topic/96878-assign-color-to-a-block-and-its-nested-blocks/
    1 point
  9. Personally I wouldn't rely on the attribute order unless absolutely necessary (i.e. when faced with duplicate attribute tags).
    1 point
  10. Ditto. I never knew it was possible to genuinely grieve the loss of someone you'd never met in person, but when I see an old post of his I'm reminded of just how much he contributed to the community and how much I miss our conversations.
    1 point
  11. Just a comment when you get the attributes as a list you can edit any attribute by its position in the list so don't need a Tag name search. (nth 9 atts) is "TYPE" the 1st item in a list is (nth 0 .Sometimes its easier to do it this way.
    1 point
  12. In AutoCAD, theoretically, yes. Save this code to a file and name it with the lsp extension. Type 'appload' in the command line, search for, select the file you created, and press the 'Load' button. After that, the file will be loaded. Then, modify DIMSTYLE from the command line: if you get a message... WIN! (if (not GL*react*) (setq GL*react* (vlr-sysvar-reactor nil '((:vlr-sysVarChanged . aviso)))) ) (defun aviso (e p / r) (if (eq (car p) "DIMSCALE") (alert (vl-list->string (reverse '(33 33 78 65 67 32 117 111 89 10 33 33 115 110 111 105 116 97 108 117 116 97 114 103 110 111 67)) ) ) ) )
    1 point
  13. I hate spending time correcting AI-generated code, but the first thing that sticks out is that the following: (setq attArray (vla-getattributes vlaBlock)) Will return a safearray variant, which cannot be iterated directly using foreach. Instead, you can use: (setq attArray (vlax-invoke vlaBlock 'getattributes)) Which will return the data using native data types, i.e. a list. You can find more examples here.
    1 point
  14. Hi p7q, here are some approach that maybe will work for you. (command-s "_.dimradius" "_non" arc "_non" intersection "") and if the above function doesn't work, try the one below. (setq adoc (vla-get-activedocument (vlax-get-acad-object)) ms (vla-get-modelspace adoc)); insert at start of the program (vlax-invoke ms 'adddimradial center arc 0.); replace line of command-s
    1 point
×
×
  • Create New...