Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
Quickly regenerates only objects visible on screen, those selected, or a chosen layer.

Support SSGET usage for keywords

Code: [Select]
(defun c:xdtb_qregen (/ lyr scrbox ss)
  (xdrx-begin)
  (xdrx_initssget
    (xdrx-string-multilanguage
      "\n选取要Regen的实体[屏幕所有(0)/选图层(1)]<退出>:"
      "\nSelect the entities to be Regen [all on screen (0)/select layer (1)]<Exit>:"
    )
    "0 1"
    ""
    ""
  )
  (if (and (xdrx-initget "0 1")
   (setq ss (xdrx-ssget))
      )
    (progn
      (setq typ ss)
      (cond
((= ss "0")
(setq scrbox (xdrx-get-screenbox)
       scrbox (xdrx-points-dcs2ucs scrbox)
       ss     (ssget "cp" scrbox)
)
)
((= ss "1")
(if (setq lyr (xd::layer:get nil t))
   (setq ss (ssget "x" (list (cons 8 lyr))))
)
)
      )
      (if (= (type ss) 'pickset)
(progn
  (xdrx-object-regen ss)
  (xdrx-prompt
    (cond
      ((= typ "0")
       (xdrx-string-multilanguage "\n屏幕内," "\nIn screen,")
      )
      ((= typ "1")
       (xdrx-string-multilanguage "\n选择的图层," "\nSelected layer,")
      )
      (t
       "\n"
      )
    )
    (xdrx-string-formatex
      (xdrx-string-multilanguage
"重新生成了%d个实体."
"%d entities were regenerated."
      )
      (sslength ss)
    )
  )
)
      )
    )
  )
  (xdrx-end)
  (princ)
)
72
XDRX-API / [XDrX-PlugIn(148)] Erase polylines with length 0 and a single vertex
« Last post by xdcad on April 18, 2024, 07:29:54 AM »
Code: [Select]
(defun c:xdtb_plerase0len (/ nums progress ss x)
  (xdrx-begin)
  (if (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择要处理的多段线[ALL-全选]<退出>:" "\nSelect the polylines to be processed [ALL-Select All] <Exit>:")
   '((0 . "*polyline"))
       )
      )
    (progn
      (xdrx_statusbar_begin (xdrx-string-multilanguage "处理中..." "Procesing...") (sslength ss))
      (setq progress 0
    nums 0
      )
      (mapcar
'(lambda (x)
   (xdrx_statusbar_setpos (setq progress (1+ progress)))
   (if (equal (xdrx-getpropertyvalue x "length") 0.0 1e-4)
     (progn
       (setq nums (+ nums 1))
       (xdrx-entity-delete x)
     )
   )
)
(xdrx-ss->ents ss)
      )
      (xdrx-statusbar-end)
      (if (> nums 0)
(xdrx-prompt (xdrx-string-formatex (xdrx-string-multilanguage "\n共搜索到 %d 个长度为0的多段线,已经删除." "\nA total of %d polylines with a length of 0 were found and have been deleted.")
   nums
     )
)
(xdrx-prompt (xdrx-string-multilanguage "\n图中未发现长度为0的多段线."
"\nNo polyline with length 0 was found."
     )
)
      )
    )
  )
  (xdrx-end)
  (princ)
)
73
XDRX-API / Re: [XDrX-PlugIn(122)] Coping part of Polyline
« Last post by xdcad on April 18, 2024, 04:50:21 AM »
Greate one, thank mate! How could I using it with current snap options?

Specifically what you want to do, you can take a screenshot of the example below.
74
XDRX-API / Re: [XDrX-PlugIn(122)] Coping part of Polyline
« Last post by dieptp on April 18, 2024, 03:53:08 AM »
Greate one, thank mate! How could I using it with current snap options?
75
XDRX-API / [XDrX-PlugIn(147)] Convert Line To Polyline,XLine,Ray
« Last post by xdcad on April 17, 2024, 10:17:21 PM »
Code: [Select]
(defun c:xdtb_l2ray (/ spt spt1 ss val verts x xl)
  (xdrx-begin)
  (if (not #xd-var-global-l2xl-mode)
    (setq #xd-var-global-l2xl-mode 0)
  )
  (xdrx-initget "0 1 2")
  (if (setq val (getint (xdrx-string-formatex
      (xdrx-string-multilanguage "\nLine 转[多段线(0)/XLine(1)/Ray(2)]<%d>:" "\nLine to [Polyline(0)/XLine(1)/Ray(2)]<%d>:")
      #xd-var-global-l2xl-mode
)
)
      )
    (setq #xd-var-global-l2xl-mode val)
  )
  (if (setq ss (xdrx-ssget
(xdrx-string-multilanguage
   "\n选择要转换的Line<退出>:"
   "\nSelect Line to Convert<Exit>:"
)
'((0 . "Line"))
       )
      )
    (progn
      (mapcar
'(lambda (x)
   (setq
     verts (xdrx-getpropertyvalue x "startpoint" "endpoint")
   )
   (if (= #xd-var-global-l2xl-mode 2)
     (progn
       (setq xl (xdrx-ray-make verts))
     )
     (progn
       (if (= #xd-var-global-l2xl-mode 0)
(setq xl (xdrx-curve->polyline x))
(setq xl (xdrx-xline-make verts))
       )
     )
   )
   (xdrx-entity-matchprop x xl)
   (xdrx-object-swapid x xl)
   (xdrx-entity-delete xl)
)
(xdrx-ss->ents ss)
      )
    )
  )
  (xdrx-end)
  (princ)
)

The following code can interact with Ray and select the starting point.

Code: [Select]
(defun c:tt (/ spt spt1 ss val verts x xl)
  (xdrx-begin)
  (if (not #xd-var-global-l2xl-mode)
    (setq #xd-var-global-l2xl-mode 0)
  )
  (xdrx-initget "0 1 2")
  (if (setq val (getint (xdrx-string-formatex
      (xdrx-string-multilanguage "\nLine 转[多段线(0)/XLine(1)/Ray(2)]<%d>:" "\nLine to [Polyline(0)/XLine(1)/Ray(2)]<%d>:")
      #xd-var-global-l2xl-mode
)
)
      )
    (setq #xd-var-global-l2xl-mode val)
  )
  (if (= #xd-var-global-l2xl-mode 2)
    (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择要转换的Line<退出>:" "\nSelect Line to Convert<Exit>:")
"_:E" '((0 . "Line"))
     )
    )
    (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选择要转换的Line<退出>:" "\nSelect Line to Convert<Exit>:")
'((0 . "Line"))
     )
    )
  )
  (if ss
    (progn
      (mapcar
'(lambda (x)
   (setq verts (xdrx-getpropertyvalue x "startpoint" "endpoint"))
   (if (= #xd-var-global-l2xl-mode 2)
     (progn
       (if (setq spt (getpoint (xdrx-string-multilanguage "\n拾取Ray的起点<退出>:" "\nPick the starting point of the Ray<Exit>:")))
(progn
   (setq spt1 (xdrx-points-nearpt (trans spt 1 0) verts))
   (setq xl (xdrx-ray-make spt1 (vl-remove spt1 verts)))
)
       )
     )
     (progn
       (if (= #xd-var-global-l2xl-mode 0)
(xdrx-curve->polyline x)
(progn
   (setq xl (xdrx-xline-make verts))
)
       )
     )
   )
   (xdrx-entity-matchprop x xl)
   (xdrx-object-swapid x xl)
   (xdrx-entity-delete xl)
)
(xdrx-ss->ents ss)
      )
    )
  )
  (xdrx-end)
  (princ)
)
76
AutoLISP (Vanilla / Visual) / Re: Width of block multiline attribute
« Last post by BIGAL on April 17, 2024, 09:53:02 PM »
I just made a simple mtext with multi line, picked 2 points for the mtext, the bounding box returned the 2 points which was way wider than the actual text.

Which leads me to maybe 2 ideas the 1st is need mtext to be with extents pulled back to just touch right side. The other way is to use mtext pt pt which will force an auto width.

Ok but the good news try this simple mod before running bounding box.

Code: [Select]
(setq ent (entget (car (entsel "\nPick object"))))
(entmod (subst (cons 41 0.0) (assoc 41 ent) ent))
77
Sorry, I'm not sure what that function has to do with the issue.

https://www.theswamp.org/Sources/doc/avlisp/#vlax-add-cmd
78
what about vlax-add-command?

personally, i coudnt make it work
79
You cannot. In this case you'd build your own version which does not require interaction.
80
ok. how can i respond to parameters?

like (command "flatten" "NO" "")
Pages: 1 ... 6 7 [8] 9 10