Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
that block needs to be exploded for modification

Why not refedit ?
73
I'm trying to do something similar, in plain AutoCAD - linking a label block with attributes to a special line having xdata storing the handle of the block. Not sure if I'm doing it the same way, as I don't quite understand the issue of "one reactor" vs. hundreds. I have this reactor, which I assign to the line:
(defun xxxx_reactor (obj)
  (vlr-pers (vlr-object-reactor (list obj) nil
              '((:vlr-modified . xxxx_modified))
  ))
)
Seems to work fine, for very many items. Now the problem:
Once an entire plan (1st floor, 2nd floor, roof) is done, that plan wants to be made into a block. At times, that block needs to be exploded for modification, then reblocked. PROBLEM: when the block is exploded, their reactors seem to be gone! Is there some way to deal with this, or am I hosed?!?
74
AutoLISP (Vanilla / Visual) / Qleader for text
« Last post by Ajmal on May 17, 2022, 09:05:12 AM »
i need to make qleader for text
My steps are following

1.    select text
2.    (setq p1 (get point))
3.    entmake Qleader from p1 to test
4.    (From offset some distance from text bounding box)
    (Leader same as attached picture.)
    (From text left or right no issue)
    (if straight, 2-point leader, or 3 point)  :idiot2:
75
AutoLISP (Vanilla / Visual) / Re: LISP to insert block and rename
« Last post by ScottMC on May 17, 2022, 08:57:23 AM »
Check out this persons helpful library.
http://www.lee-mac.com/copyblock.html
76
AutoLISP (Vanilla / Visual) / Re: Convert line & arc to Polyline
« Last post by dexus on May 17, 2022, 08:15:29 AM »
I change the PEDITACCEPT variable so you don't have to add "_Y".
That way it also works if it already is set to 1.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:convert_arc_line (/ ss internalcounter ~CMD ~PEDITACCEPT *error*)
  2.   (defun *error* (msg)
  3.     (setvar "CMDECHO" ~CMD)
  4.     (setvar "PEDITACCEPT" ~PEDITACCEPT)
  5.     (princ msg)
  6.     (princ)
  7.   )
  8.   (setq ~CMD (getvar "CMDECHO"))
  9.   (setvar "CMDECHO" 0)
  10.   (setq ~PEDITACCEPT (getvar "PEDITACCEPT"))
  11.   (setvar "PEDITACCEPT" 1) ; Temperaraly set PEDITACCEPT to 1 so it doesn't ask to confirm the conversion to Polyline
  12.  
  13.   (if (setq ss (ssget "X" '((0 . "LINE,ARC"))))
  14.     (progn ; Make selection and continue if anything is found
  15.       (setq internalcounter (sslength ss))
  16.       (princ (strcat (itoa internalcounter) " object(s) found."))
  17.       (repeat internalcounter
  18.         (vl-cmdf "_pedit" (ssname ss (setq internalcounter (1- internalcounter))) "") ; Preform pedit to convert
  19.       )
  20.     )
  21.     (princ "No Line or Arc objects found.")
  22.   )
  23.  
  24.   (setvar "CMDECHO" ~CMD)
  25.   (setvar "PEDITACCEPT" ~PEDITACCEPT)
  26.   (princ)
  27. )
77
AutoLISP (Vanilla / Visual) / Re: Convert line & arc to Polyline
« Last post by mhupp on May 17, 2022, 08:11:14 AM »
when nothing is selected with ssget for arc and line they are still nil. You can't use sslength on a nil selection set.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:convert_arc_line (/ arc a line l)
  2.   (setq a "0" l "0")
  3.   (if (setq arc (ssget "_X" '((0 . "ARC") (410 . "Model"))))
  4.     (progn
  5.       (command "_.pedit" "_m" arc "" "_Y" "")
  6.       (setq a (itoa (sslength arc)))
  7.     )
  8.     (princ (strcat "\nMohan there were no arc Object(s) found ... "))
  9.   )
  10.   (if (setq line (ssget "_X" '((0 . "LINE") (410 . "Model"))))
  11.     (progn
  12.       (command "_.pedit" "_m" line "" "_Y" "")
  13.       (setq l (itoa (sslength line)))
  14.     )
  15.     (princ (strcat "\nMohan there were no line Object(s) found ... "))
  16.   )
  17.   (princ (strcat "\nMohan total of " a " Arc Object(s) & " l " Line Object(s) were converted to Polylines ... "))
  18.   (princ)
  19. )

This will default to: Mohan total of 0 Arc Object(s) & 0 Line Object(s) were converted to Polylines ...
if any arc or lines are converted it will update the 0 to that number.

---Edit
Might also want to limit your selection to model space or ctab (current tab). "_X" picks up any line or arc in the drawing even on other tabs but the command line pedit will only modify lines and arcs on current tab.
78
AutoLISP (Vanilla / Visual) / Convert line & arc to Polyline
« Last post by mohan on May 17, 2022, 06:40:57 AM »
Code: [Select]
(defun c:convert_arc_line ( / arc line)
(if (setq arc (ssget "_X" '((0 . "ARC")))) (command "_.pedit" "_m" arc "" "_Y" "") (princ (strcat "\nMohan there were no arc Object(s) found ... ")))
(if (setq line (ssget "_X" '((0 . "LINE")))) (command "_.pedit" "_m" line "" "_Y" "") (princ (strcat "\nMohan there were no line Object(s) found ... ")))
(princ (strcat "\nMohan total of " (itoa (sslength arc)) " Arc Object(s) & " (itoa (sslength line)) " Line Object(s) were converted to Polylines ... " ))
(princ))
Command: CONVERT_ARC_LINE
_.pedit
Select polyline or [Multiple]: _m
Select objects:   1 found

Select objects:
Convert Lines, Arcs and Splines to polylines [Yes/No]? <Y> _Y
Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Reverse/Undo]:
Command: _.pedit
Select polyline or [Multiple]: _m
Select objects:   2 found

Select objects:
Convert Lines, Arcs and Splines to polylines [Yes/No]? <Y> _Y
Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Reverse/Undo]:
Command:
Mohan total of 1 Arc Object(s) & 2 Line Object(s) were converted to Polylines ...

Command: CONVERT_ARC_LINE

Mohan there were no arc Object(s) found ...
Mohan there were no line Object(s) found ... ; error: bad argument type: lselsetp nil

Note: If there were no objects of (line or arc) why this error shows "error: bad argument..............
Please anyone help to fix it.
79
AutoLISP (Vanilla / Visual) / Re: LISP to insert block and rename
« Last post by like_citrus on May 16, 2022, 07:45:47 PM »
Thanks for sending this. I'll look into it soon.
80
AutoLISP (Vanilla / Visual) / Getting down to the numbers [dims]
« Last post by ScottMC on May 16, 2022, 06:34:03 PM »
Rare.. Here's a micro tool to help when needing a number trans!
 Just got it runnin so lacking the filters desired + the 'Text Override' OMH..

Code: [Select]
(defun c:gdt ( / a  ldtx) ;; http://www.theswamp.org/index.php?topic=404.msg4785#msg4785
  (vlax-add-cmd "gdt" 'c:gdt "gdt" acrx_cmd_transparent) ;; allows trans use!
  (princ "\n Dim Extractor..")
        (setq a (entget (car (entsel)))) ;; Keith..
        (setq ldtx (distof (rtos (cdr (assoc 42 a))(getvar "lunits")(getvar "luprec"))))
 ;(princ (strcat "\n Dim Length: "(rtos ldtx)))
 (princ (rtos ldtx))
(princ)
)
Pages: 1 ... 6 7 [8] 9 10