Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
AutoLISP (Vanilla / Visual) / Re: "ssget everything" for a single point?
« Last post by ribarm on April 24, 2024, 10:03:25 AM »
Maybe :
Code: [Select]
(sssetfirst nil (ssget "_C" pt pt))
32
AutoLISP (Vanilla / Visual) / "ssget everything" for a single point?
« Last post by Peter2 on April 24, 2024, 09:59:40 AM »
I have tons of hatches, usually as solid-hatch-pattern, and sometimes partially or totally overlapping.
I want to select the overlapping ones on a single point - like a needle which I stick on a bunch of paper sheets: all the sheets on this needle-picking-point are selected.

(An option would be to define a cross-poly or a cross-window with very small area, but maybe there is really a "needle-ssget"?)
33
AutoLISP (Vanilla / Visual) / Re: [request] Radiant Pipe Layout
« Last post by JohnK on April 24, 2024, 08:49:37 AM »
Oh, that's too bad. I guess I'll just have to chip away at the problem in my spare time then.

BTW, that's a "spiral"; not sure if I'm correct or not but I've always used a sort of "reverse return" layout to hopefully get a more even heat distribution on the panel (aka floor). So, given my luck, my pattern will be impossible to code. :]
34
a thank you from me too
great job you're doing there

thanks, If test found problem,plz tell me

@domenicomaria
35
a thank you from me too
great job you're doing there
36
AutoLISP (Vanilla / Visual) / Re: Ssget filter for mirrored multileader
« Last post by Jeff_M on April 23, 2024, 08:32:11 PM »
It should be noted that Mleaders which use a block instead of Mtext do not have the DXF 13 code.
37
AutoLISP (Vanilla / Visual) / Re: Lisp to Create multiple viewport
« Last post by BIGAL on April 23, 2024, 07:26:39 PM »
Do you want make viewports at scale to match a title block in Layouts like in this image the red rectangs have been made matching a MVIEW at scale. This is a slect P/Line and walk along or by placing rectangs, Rotation is supported by twisting view in layout.

38
AutoLISP (Vanilla / Visual) / Re: factorial of decimal number...
« Last post by kirby on April 23, 2024, 06:42:21 PM »
Fun end of day mental exercise...

Test function matches Excel to 5 decimal places (vs. built in functions GAMMALN & GAMMA, decimal factorial computed from X*Gamma(X))
and in range of 0.1 to 10.0 in 0.1 increments
(but maybe Excel is wrong too...)

Code - Auto/Visual Lisp: [Select]
  1. (defun C:TestGamma ( / CNT MyVal LG G DF)
  2. ; Test function for 'LnGamma', 'Gamma', and 'DecimalFact'
  3. ; KJM - April 2024
  4. ; Uses custom functions
  5. ;       lngamma
  6. ;       gamma
  7. ;       decimalfact
  8.  
  9. (setq OutList nil)
  10.  
  11. (prompt "\nValue  LnGamma  Gamma  DecFact")
  12.  
  13. ; Test from 0.1 to 10.0
  14. (setq CNT 1)
  15. (repeat 100
  16.         (setq MyVal (/ (float CNT) 10.0))
  17.  
  18.         (setq LG (lngamma MyVal))
  19.         (setq G (gamma MyVal))
  20.         (setq DF (DecimalFact MyVal))
  21.  
  22.         ; Report
  23.         (prompt "\n")(princ (rtos MyVal 2 3))
  24.         (prompt "  ")(princ (rtos LG 2 5))
  25.         (prompt "  ")(princ (rtos G 2 5))
  26.         (prompt "  ")(princ (rtos DF 2 5))
  27.  
  28.         (setq OutList (cons (list MyVal LG G DF) OutList))
  29.  
  30.         (setq CNT (1+ CNT))
  31. ) ; close repeat
  32.  
  33. (prompt "\nCompleted!")
  34. )
  35.  
  36.  
  37.  
  38. (defun DecimalFact ( X /
  39.                 OutVal tol
  40.                 )
  41. ; Decimal factorial function x! = x*gamma(x)
  42. ; KJM - April 2024
  43. ; Input
  44. ;       X - (positive real)
  45. ; Returns
  46. ;       Natural logarithm of gamma function
  47. ; Uses custom functions:
  48. ;       Gamma
  49.  
  50. (setq OutVal nil)
  51.  
  52. (setq tol 1e-6)
  53.  
  54. (if (> X tol)   ; Must by positive
  55.         (setq OutVal (* X (gamma X)))
  56. ) ; close if
  57.  
  58. OutVal
  59. )
  60.  
  61.  
  62. (defun Gamma ( X /
  63.                 OutVal tol
  64.                 )
  65. ; Gamma function
  66. ; KJM - April 2024
  67. ; Input
  68. ;       X - (positive real)
  69. ; Returns
  70. ;       gamma function of X
  71. ; Uses custom functions:
  72. ;       LnGamma
  73.  
  74. (setq OutVal nil)
  75.  
  76. (setq tol 1e-6)
  77.  
  78. (if (> X tol)   ; Must by positive
  79.         (setq OutVal (exp (lngamma X)))
  80. ) ; close if
  81.  
  82. OutVal
  83. )
  84.  
  85.  
  86. (defun LnGamma ( X /
  87.         OutVal tol Coeff B A CNT
  88.         )
  89. ; Natural Log of Gamma function by Lanczos approximation
  90. ; KJM - April 2024
  91. ; Input
  92. ;       X - (positive real)
  93. ; Returns
  94. ;       Natural logarithm of gamma function of X
  95. ; Uses custom functions:
  96. ;       none!
  97.  
  98. ; See:
  99. ;       https://en.wikipedia.org/wiki/Lanczos_approximation
  100.  
  101.  
  102. (setq OutVal nil)
  103.  
  104. (setq tol 1e-6)
  105.  
  106. (if (> X tol)   ; Must by positive
  107.   (progn
  108.  
  109.         (setq Coeff (list       ; list of 7 coefficients
  110.                   1.000000000190015
  111.                  76.180091729471463
  112.                 -86.505320329416768
  113.                  24.014098240830910
  114.                  -1.231739572450155
  115.                   0.001208650973866
  116.                  -0.000005395239385
  117.         )) ; close setq list
  118.        
  119.         (if (< X 0.5)
  120.           (progn
  121.                 ; Reflection formula for small X
  122.                 (setq OutVal (-
  123.                         (log (/ pi (sin (* X pi))))
  124.                         (LnGamma (- 1.0 X))
  125.                 ))
  126.           )
  127.           (progn
  128.                 (setq X (- X 1.0))
  129.                 (setq B (+ X 5.5))
  130.                 (setq A (nth 0 Coeff))
  131.                
  132.                 (setq CNT 1)
  133.                 (repeat (1- (length Coeff))
  134.                         (setq A (+ A (/ (nth CNT Coeff) (+ X (float CNT)))))
  135.                         (setq CNT (1+ CNT))
  136.                 ) ; close repeat
  137.                
  138.                 (setq OutVal (+
  139.                         (log (sqrt (* 2.0 pi)))
  140.                         (log A)
  141.                         (* -1.0 B)
  142.                         (* (log B) (+ X 0.5))
  143.                 ))
  144.           )
  145.         ) ; close if   
  146.   )
  147. ) ; close if
  148. OutVal
  149. )
  150.  
39
AutoLISP (Vanilla / Visual) / Re: Ssget filter for mirrored multileader
« Last post by ronjonp on April 23, 2024, 05:29:43 PM »
This works for me on your sample drawing.
Code - Auto/Visual Lisp: [Select]
  1. (sssetfirst nil (ssget "_X" '((0 . "MULTILEADER") (13 -1.0 0.0 0.0))))
Thanks ronjonp! This does work on my version of AutoCAD.
...
Cheers!  :-)
40
AutoLISP (Vanilla / Visual) / Re: [request] Radiant Pipe Layout
« Last post by ribarm on April 23, 2024, 03:26:51 PM »
@BIGAL states that there are plenty links on www just by google-ing, but AFAIK I have only this link where I was involved...
https://www.cadtutor.net/forum/files/file/47-floor-heating/

HTH.
M.R.

BTW. It is very delicate to code for it, but we tried - I mean me and L.M. (Lee Mac)...
Pages: 1 2 3 [4] 5 6 ... 10