Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Re: finding nested xrefs - AutoLISP
« Last post by cadpoobah on Today at 02:28:46 PM »
Below is a variation of the code I previously posted here, modified to apply to xrefs only:
Code - Auto/Visual Lisp: [Select]
  1. (defun _nestedxrefs ( blk / enx rtn xrn )
  2.    (while (setq blk (entnext blk))
  3. ...
  4.        (_xrefhierarchy)
  5.    )
  6.    (princ)
  7. )

Excellent, Lee. Thanks for sharing.

Curious, what is the order of the list that (_xrefhierarchy) returns? Is it random based on how tblnext finds the refs? Also, does it always list the "deepest" (child) references first, followed by any parent xrefs w child xrefs?

What I see is something like this:
  (("Child1") ("Child2") ("Childn") ("Parent1" "Child1") ("Parent2" "Child2")...)

2
AutoLISP (Vanilla / Visual) / Re: [request] Radiant Pipe Layout
« Last post by ribarm on Today at 10:34:10 AM »
John, I coded for sample which is going to be copied like in my shown example... If you want 9.0 from bottom of room, just move sample for 4.5 upward and add small line for entering which connects sample and entering point... Sample is calculated the way that allows exiting pipe to be distanced from wall for 9.0 units from left wall side... So exiting and entering pipes are distanced at 9.0 units between each other... My picture explains everything, only you wanted to move sample for 4.5 upward; you must add small pipe line if you want or keep like you want and not like it is with my picture...
That's all, I hope it helps...
Regards...
3
AutoLISP (Vanilla / Visual) / Re: [request] Radiant Pipe Layout
« Last post by JohnK on Today at 10:15:42 AM »
Thank you.
The picture looks promising but when I ran a quick test I didn't get good results.

I entered 9 as my "offset distance".
4
AutoLISP (Vanilla / Visual) / grread to quick keyword
« Last post by masao on Today at 09:46:21 AM »
hi~i read this https://www.theswamp.org/index.php?topic=34804

and has two questions about grread

1)

if i want to add else keyword into LM:UCS-ssget,how can i add it.

(setq size (LM:UCS-ssget (strcat "\n->[ARC(A)/CIRCLE(B)/ARC and CIRCLE(N)]
\n->Filter by:[radius size(R)/circle color(C)/circle linetype(L)]
\n->select object or[setting(S)]{now radius size" (rtos radius size) "now circle color" (rtos circle color) "now circle linetype" circle linetype "}:")))

if key A

(ssget (list '(0 . "ARC")))

if key B

(ssget (list '(0 . "CIRCLE")))

if key N

(ssget (list '(0 . "ARC,CIRCLE")))

if key R

enter radius size setting

(setq radius size (getreal))

then back (setq size (LM:UCS-ssget

if key C

enter circle color setting

(setq circle color (acad_colordlg 7))

then back (setq size (LM:UCS-ssget

if key L

enter circle linetype setting

(setq circle linetype (getstring))

then back (setq size (LM:UCS-ssget

if i key A and setting radius size=5 circle color=2 circle linetype="HIDDEN"

get (ssget (list '(0 . "ARC" (cons 40 5) (cons 62 2) (cons 6 "HIDDEN"))))

it can make it?

2) and grread can use both getstring and keyword , if enter getstring word not affected by keyword(if Key A can enter else funtoin but getstring word has "A"  alphabet.)

on grread funtion use Right click and Enter has different?
5
Nice Job. Very Powerful.
6
AutoLISP (Vanilla / Visual) / Re: Attribute Text Width
« Last post by ribarm on Today at 07:57:28 AM »
Thanks for the help.
And sorry for the late reply as too busy after Easter.

Another thought...
How to update the text width if it is an attribute in title blocks in a multi-page drawing?
Thanks.

Have you tried changing this line :
Code: [Select]
(setq sel (ssget '((0 . "INSERT") (2 . "BLK-01"))));BLK-01
To this :
Code: [Select]
(setq sel (ssget "_X" '((0 . "INSERT") (2 . "BLK-01"))));BLK-01
And then iterate through sel. set 'sel'...
7
AutoLISP (Vanilla / Visual) / Re: Attribute Text Width
« Last post by MeasureUp on Today at 07:07:41 AM »
Thanks for the help.
And sorry for the late reply as too busy after Easter.

Another thought...
How to update the text width if it is an attribute in title blocks in a multi-page drawing?
Thanks.
8
Hi, I have some routines written in Civil 3D which use following functions :-
ade_odgettables
ade_odrecordqty
ade_odtabledefn
ade_odgetfield
etc etc.

But these functions are not available in BricsCAD. Is there any alternative to Get or Set Object Data in BricsCAD through LISP ?
9
AutoLISP (Vanilla / Visual) / Re: dietpl.lsp - solving endless while loop
« Last post by ribarm on Today at 03:17:52 AM »
Problem sucessfuly solved...
Here is the code...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dietlw ( / vertlst bulglst collinear-p group_collinear_pts group_fuzz_pts clockwise-p s fuzz lw ptlst blst assoclst gg g n p1 p2 p3 b nlw lwx )
  2.  
  3.   (defun vertlst ( lwx )
  4.     (mapcar (function cdr) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) lwx))
  5.   )
  6.  
  7.   (defun bulglst ( lwx )
  8.     (mapcar (function cdr) (vl-remove-if (function (lambda ( x ) (/= (car x) 42))) lwx))
  9.   )
  10.  
  11.   (defun collinear-p ( p1 p p2 )
  12.     (equal (distance p1 p2) (+ (distance p1 p) (distance p p2)) 1e-6)
  13.   )
  14.  
  15.   (defun group_collinear_pts ( ptlst / a b c g gg )
  16.     (while ptlst
  17.       (setq a (car ptlst) b (cadr ptlst) c (caddr ptlst))
  18.       (while (and c (collinear-p a b c))
  19.         (if (not (vl-position a g))
  20.           (setq g (cons a g))
  21.         )
  22.         (if (not (vl-position b g))
  23.           (setq g (cons b g))
  24.         )
  25.         (if (not (vl-position c g))
  26.           (setq g (cons c g))
  27.         )
  28.         (setq ptlst (cdr ptlst))
  29.         (setq a (car ptlst) b (cadr ptlst) c (caddr ptlst))
  30.       )
  31.       (setq ptlst (cdr ptlst))
  32.       (if g
  33.         (setq gg (cons (reverse g) gg))
  34.       )
  35.       (setq g nil)
  36.     )
  37.     (reverse gg)
  38.   )
  39.  
  40.   (defun group_fuzz_pts ( ptlst fuzz / a b c f ff g gg )
  41.     (while ptlst
  42.       (setq a (car ptlst) b (cadr ptlst) c (caddr ptlst))
  43.       (if (and a b c)
  44.         (setq ff nil)
  45.       )
  46.       (while (and (not ff) c (and b (< (distance a b) fuzz)) (and c (< (distance b c) fuzz)))
  47.         (setq f (clockwise-p a b c))
  48.         (if (not (vl-position a g))
  49.           (setq g (cons a g))
  50.         )
  51.         (if (not (vl-position b g))
  52.           (setq g (cons b g))
  53.         )
  54.         (if (not (vl-position c g))
  55.           (setq g (cons c g))
  56.         )
  57.         (setq ptlst (cdr ptlst))
  58.         (setq a (car ptlst) b (cadr ptlst) c (caddr ptlst))
  59.         (if (and c (/= f (clockwise-p a b c)))
  60.           (setq ff t)
  61.           (setq ff nil)
  62.         )
  63.       )
  64.       (setq ptlst (cdr ptlst))
  65.       (if g
  66.         (setq gg (cons (reverse g) gg))
  67.       )
  68.       (setq g nil)
  69.     )
  70.     (reverse gg)
  71.   )
  72.  
  73.   (defun clockwise-p ( p1 p p2 )
  74.     (minusp (- (* (car (mapcar (function -) p1 p)) (cadr (mapcar (function -) p2 p))) (* (cadr (mapcar (function -) p1 p)) (car (mapcar (function -) p2 p)))))
  75.   )
  76.  
  77.   (prompt "\nPick LWPOLYLINE to make it with diet...")
  78.   (if
  79.     (and
  80.       (setq s (ssget "_+.:E:S" (list (cons 0 "LWPOLYLINE"))))
  81.       (not (initget 7))
  82.       (setq fuzz (getdist "\nPick or specify fuzz distance : "))
  83.     )
  84.     (progn
  85.       (setq lwx (entget (setq lw (ssname s 0))))
  86.       (setq ptlst (vertlst lwx))
  87.       (setq blst (bulglst lwx))
  88.       (setq assoclst (mapcar (function (lambda ( p b ) (cons p b))) ptlst blst))
  89.       (setq gg (group_collinear_pts ptlst))
  90.       (foreach g gg
  91.         (setq g (cdr g) g (reverse (cdr (reverse g))))
  92.         (foreach p g
  93.           (setq assoclst (vl-remove-if (function (lambda ( x ) (equal p (car x) 1e-6))) assoclst))
  94.         )
  95.       )
  96.       (setq gg (group_fuzz_pts (mapcar (function car) assoclst) fuzz))
  97.       (foreach g gg
  98.         (setq n (length g))
  99.         (setq p1 (car g) p2 (nth (if (> n 3) (fix (/ n 2.0)) 1) g) p3 (last g))
  100.         (vl-cmdf "_.pline" "_non" p1 "_a" "_s" "_non" p2 "_non" p3 "")
  101.         (setq b (cdr (assoc 42 (entget (entlast)))))
  102.         (entdel (entlast))
  103.         (setq assoclst (subst (cons (car g) b) (vl-some (function (lambda ( x ) (if (equal (car x) (car g) 1e-6) x))) assoclst) assoclst))
  104.         (setq g (cdr g) g (reverse (cdr (reverse g))))
  105.         (foreach p g
  106.           (setq assoclst (vl-remove-if (function (lambda ( x ) (equal p (car x) 1e-6))) assoclst))
  107.         )
  108.       )
  109.       (if (and (= 1 (logand 1 (cdr (assoc 70 lwx)))) (< (distance (caar assoclst) (car (last assoclst))) fuzz))
  110.         (setq assoclst (reverse (cdr (reverse assoclst))))
  111.       )
  112.       (setq nlw
  113.         (entmakex
  114.           (append
  115.             (list
  116.               (cons 0 "LWPOLYLINE")
  117.               (cons 100 "AcDbEntity")
  118.               (cons 100 "AcDbPolyline")
  119.               (cons 90 (length assoclst))
  120.               (assoc 70 lwx)
  121.               (assoc 38 lwx)
  122.             )
  123.             (apply (function append) (mapcar (function (lambda ( p b ) (list (cons 10 p) (cons 42 b)))) (mapcar (function car) assoclst) (mapcar (function cdr) assoclst)))
  124.             (list (assoc 210 lwx))
  125.           )
  126.         )
  127.       )
  128.     )
  129.   )
  130.   (princ)
  131. )
  132.  

HTH.
M.R.
10
.NET / Re: Ribbon for ZWCAD
« Last post by It's Alive! on Today at 01:54:50 AM »
I tried to port an AutoCAD plugin to ZWCAD, I gave up after an hour. The ZW .NET API is a thousand paper cuts different. BricsCAD was a walk in the park, as is the ODA .NET Classic library.
Interesting, Not using .NET anymore, but ZW’s C++ API is generally pretty good. 
Did you reach out to them?
Pages: [1] 2 3 ... 10