Ã÷¾­CADÉçÇø

 ÕÒ»ØÃÜÂë
 ×¢²á

QQ怬

Ö»ÐèÒ»²½£¬¿ìËÙ¿ªÊ¼

ËÑË÷
²é¿´: 19663|»Ø¸´: 33

LISPµ÷ÓÃDLLÎļþÉú³ÉËæ»úÊý

    [¸´ÖÆÁ´½Ó]
·¢±íÓÚ 2007-1-5 22:04:00 | ÏÔʾȫ²¿Â¥²ã |ÔĶÁģʽ

ÕâÊÇÓÃLISPµ÷ÓÃDLLÎļþÉú³ÉËæ»úÊýµÄ³ÌÐòʾÀý¡£

ÔÚVB6Öд´½¨Ò»¸öActiveX DLL¹¤³Ì£¬ÔÚÆäÖн«ÀàÄ£¿éÐÞ¸ÄΪRND£¬½«¹¤³ÌÃûÐÞ¸ÄΪRNDAPP¡£ÔÚÆäÖÐÌí¼ÓÏÂÃæµÄ´úÂ룺
Public Function GetRND() As Double
  Dim i As Double
  i = RND
  GetRND = i
End Function
½«Æä±àÒë³ÉDLLÎļþ£¨¡°RND.dll¡±£©¡£
ÔÚWINDOWSÏÂ×¢²áÕâ¸öDLLÎļþ¡£
ÏȽ«Õâ¸öÎļþ¿½ÈëCÅ̸ùĿ¼Ï£¨×¢£ºÒ²¿É·ÅÈëÏàÓ¦Îļþ¼Ðϵ«Îļþ¼ÐÃû³ÆÖв»ÄÜÓпոñ£©¡£
ÔÙÔÚÔËÐÐÖмÓÈëÔËÐÐÈçÏÂÃüÁRegsvr32 c:\RND.dll

È»ºó±àLISP³ÌÐò¡£
(defun c:testrnd( / rndobj rndnum)
  (setq rndobj (vlax-get-or-create-object "RNDAPP.RND"))
  (setq rndnum (vlax-invoke-method rndobj "GetRND"))
  (princ rndnum )
  (princ)
)
ÕâÀïµÄrndnum¾ÍÊÇÏàÒªµÄËæ»úÊý¡£

ÕâÀïÊDzâÊÔ½á¹û£º
ÃüÁî: testrnd
0.592458
ÃüÁî:
ÃüÁî: testrnd
0.4687
ÃüÁî:
ÃüÁî: testrnd
0.298165
ÃüÁî:
ÃüÁî: testrnd
0.622697
ÃüÁî:
ÃüÁî: testrnd
0.647821
ÃüÁî:
ÃüÁî: testrnd
0.263793
ÃüÁî:
ÃüÁî: testrnd
0.279342
ÃüÁî:
ÃüÁî: testrnd
0.829802
ÃüÁî:
ÃüÁî: testrnd
0.824602
ÃüÁî:
ÃüÁî: testrnd
0.589163
ÃüÁî:
ÃüÁî: testrnd
0.986093
ÃüÁî:
ÃüÁî: testrnd
0.910964

±¾Ìû×ÓÖаüº¬¸ü¶à×ÊÔ´

ÄúÐèÒª µÇ¼ ²Å¿ÉÒÔÏÂÔØ»ò²é¿´£¬Ã»ÓÐÕ˺ţ¿×¢²á

x

µãÆÀ

´ó¼Ò±àдDLLʱ×îºÃÔÙ¼ÓÒ»¸örandomize£¬ÎÒµÄûÓмӣ¬¼ÆËã³öµÄµÚÒ»¸öÊý×Ö¾­³£ÊÇ7£¬¼ÓÁËÖ®ºó¾Í½â¾öÁË  ·¢±íÓÚ 2012-6-15 17:02

ÆÀ·Ö

²ÎÓëÈËÊý 2ÍþÍû +1 Ã÷¾­±Ò +3 ½ðÇ® +20 ¹±Ï× +5 ¼¤Çé +5 ÊÕÆð ÀíÓÉ
¸ïÌìÃ÷ + 1 »¹ÊÇDLL¸øÁ¦£¬
mccad + 1 + 2 + 20 + 5 + 5 ¡¾¾«»ª¡¿ºÃ³ÌÐò

²é¿´È«²¿ÆÀ·Ö

·¢±íÓÚ 2007-1-23 00:02:00 | ÏÔʾȫ²¿Â¥²ã
±¾Ìû×îºóÓÉ ×÷Õß ÓÚ 2007-1-23 0:05:14 ±à¼­

  1. (defun C:TT2 (/ ETIME LST N STIME X)
  2.   (setq N   0
  3. LST NIL
  4.   )
  5.   (repeat 10000
  6.     (setq LST (cons (setq N (1+ N)) LST))
  7.   )
  8.   (setq STIME (getvar "date"))
  9.   (setq LST (mapcar '(lambda (X) (nth X LST)) (rndsi (length lst))))
  10.   (setq ETIME (getvar "date"))
  11.   (prompt
  12.     (strcat
  13.       "\n³Ìʽ¹²ºÄÓÕrég: "
  14.       (rtos (* 86400.0 (- (- ETIME STIME) (fix (- ETIME STIME))))
  15.      2
  16.      3
  17.       )
  18.       "Ãë\n"
  19.     )
  20.   )
  21.   LST
  22. )
³Ìʽ¹²ºÄÓÕrég: 0.469Ãë
³ÌÐòÒ²ÓÃÁËcputicks
rndsiºÍtt2ÒѾ­´ò°ü,ÏÂÔؽâѹºóµ÷Èëcad¿ÉÖ±½ÓÔËÐÐtt2

·¢±íÓÚ 2023-10-7 23:14:05 | ÏÔʾȫ²¿Â¥²ã
ÒÔÇ°¶¼ÄÜÕý³£Ö§Ðеģ¬µ«ÏÖÔÚÌáʾÕâ¸öÁË
ÃüÁî: testrnd ³ö´í: ²ÎÊýÀàÐÍ´íÎó: VLA-OBJECT nil
²»ÖªµÀÊDz»ÊÇÒòΪÓõÄ64λϵͳºÍ64λCADµÄÔ­Òò¡£Ôõô½â¾öÄØ£¿

·¢±íÓÚ 2018-7-4 11:11:52 À´×ÔÊÖ»ú | ÏÔʾȫ²¿Â¥²ã
ºÃÌù£¬ÎÒÒªÊÔÊÔ64λÈí¼þÄܲ»Äܵ÷ÓÃ32λµÄDLL
·¢±íÓÚ 2007-1-5 22:37:00 | ÏÔʾȫ²¿Â¥²ã
¶¥!ºÜºÃ£¡Ñ§Ï°
 Â¥Ö÷| ·¢±íÓÚ 2007-1-5 22:56:00 | ÏÔʾȫ²¿Â¥²ã
Ô­´´£¬´ó¼ÒÏÂÔØÑо¿°É¡£¹¦ÄÜÐè´ó¼Ò×ÔÒÑ¿ª·¢¡£LISPºÍVBA¶¼¿ÉÓÃDLLÎļþÀ©Õ¹£¬ºÇ¡­¡­½«Ò»Ð©LISP»òVBA×ö²»Á˵Ť×÷½»¸øVBÉú³ÉµÄDLLºÃÁË¡£
·¢±íÓÚ 2007-1-6 12:39:00 | ÏÔʾȫ²¿Â¥²ã

Õâ¸ö·½·¨²»´í£¬µ«È´ÐèÒªÈ˹¤ÊäÈëRegsvr32 c:\RND.dll£¬Õâµã²»ºÃ

ÎÒ±¾À´ÏëÔÚlispÇ°¼ÓÉÏÒ»¾ä (STARTAPP "Regsvr32" "c:\\RND.dll")£¬µ«Êǻᵯ³ö¡°È·¶¨¡±°´Å¥

²»ÖªµÀÓÃvl-registry-writeÐв»ÐУ¿²»¹ýÈ´²»ÖªµÀÓ¦¸ÃÔÚ×¢²á±íÄĸöλÖã¿

ÍûÂ¥Ö÷Ö¸µã

·¢±íÓÚ 2007-1-6 13:11:00 | ÏÔʾȫ²¿Â¥²ã

×Ô¼º½â¾öÁË

ÔÚÇ°Ãæ¼ÓÉÏÒ»¾ä (STARTAPP "Regsvr32" (strcat "/s \"" "c:\\RND.dll" "\""))¾Í¿ÉÒÔÁË

µãÆÀ

»¹ÊÇÄãÀ÷º¦£¬ÎÒʹÓõÄÊÇBATÀ´×¢²áDLL£¬µ«ºÚÉ«´°¿ÚÕæÈÃÈ˲»Ë¬£¬ ʹÓÃ×¢²á±íÀ´±£´æÊÇ·ñ×¢²á¹ýÕâЩDLL£¬Èô×¢²á¹ý¾Í²»±Ø×¢²á£¬¾ßÌå³ÌÐòʹÓÃʱÈô·¢ÏÖ³ö´íÁË£¬Ôò°Ñ×¢²á±íÖеļüÖµ¸ÄΪ¼Ù  ·¢±íÓÚ 2013-1-4 08:44
 Â¥Ö÷| ·¢±íÓÚ 2007-1-6 14:16:00 | ÏÔʾȫ²¿Â¥²ã
ºÃ×ÔÒÑÑо¿µÄ»á¼ÇµÄÉî¿Ì¡£
 Â¥Ö÷| ·¢±íÓÚ 2007-1-17 19:47:00 | ÏÔʾȫ²¿Â¥²ã

¶¥»ØÈ¥¡£

·¢±íÓÚ 2007-1-18 09:51:00 | ÏÔʾȫ²¿Â¥²ã
±¾Ìû×îºóÓÉ ×÷Õß ÓÚ 2007-1-18 10:40:29 ±à¼­

Õâ¸ö·½·¨ºÜ²»´í£¬°ÑlispÍê³É²»Á˵ĺ¯Êý½»¸øVBÀ´×ö£¡
µ«ÊǶÔÓÚÕâ¸öËæ»úº¯ÊýÖ»ÄÜÉú³É0-1Ö®¼äµÄÖµ£¬×îºÃÄÜÉúij¸ö·¶Î§ÄÚµÄËæ»úÊý.
  1. (defun rnd (rMin rMax / rndobj rndnum)
  2.   (setq rndobj (vlax-get-or-create-object "RNDAPP.RND"))
  3.   (setq rndnum (vlax-invoke-method rndobj "GetRND"));È¡µÃËæ»úÊý
  4.   (if (and (= (type rmin) (type 1))(= (type rmax) (type 1)));Èç¹ûÊÇÕûÊý
  5.     (fix (+ rMin (* rndnum (- rMax rMin -1))))      ;ÔòÈ¡Õû
  6.     (+ rMin (* rndnum (- rMax rMin)))               ;¶Ô´Ë·¶Î§ÄÚÇóÖµ
  7.   )  
  8. )
ÉÔ΢¸ÄÁËÒ»ÏÂlispº¯Êý¡£
ÏÂÃæÊǶÔÎÞºÛÄǸöº¯ÊýµÄÐ޸ģ¬ÄÜ×Ô¶¯ÅжÏÕûÊýºÍʵÊý¡£
  1. (defun rnd (rMin rMax / rndnum)
  2.   (vla-eval (vlax-get-acad-object) "ThisDrawing.setVariable "USERR5" ,CDbl((Rnd))")
  3.   (setq rndnum (getvar "userr5"))                            ;È¡µÃËæ»úÊý
  4.   (if (and (= (type rmin) (type 1)) (= (type rmax) (type 1)));Èç¹ûÊÇÕûÊý
  5.     (fix (+ rMin (* rndnum (- rMax rMin -1))))               ;ÔòÈ¡Õû
  6.     (+ rMin (* rndnum (- rMax rMin)))                        ;·ñÔòÇó´Ë·¶Î§ÄÚËæ»úÖµ
  7.   )
  8. )
·¢±íÓÚ 2007-1-18 10:10:00 | ÏÔʾȫ²¿Â¥²ã
±¾Ìû×îºóÓÉ ×÷Õß ÓÚ 2007-1-18 10:18:56 ±à¼­

×ܸоõÓÃDLLÀ´Éú³ÉÒ»¸öËæ»úÊýÓÐЩСÌâ´ó×÷¡£
ÎÒÀ´Ð´Ò»¸ö,²Î¿¼Î޺۵ģº
  1. ;Éú³ÉËæ»úÊý-by mccad:
  2. (defun rnd(rMin rMax)
  3.   (vla-eval (vlax-get-acad-object) "Randomize : ThisDrawing.setVariable "USERR5" ,CDbl((Rnd))" )
  4.   (+ rMin(* (getvar "userr5")(- rMax rMin)))
  5. )
·¢±íÓÚ 2007-1-18 14:37:00 | ÏÔʾȫ²¿Â¥²ã
Õâ¸ö·½·¨Ô­ÏÈÊÇÔÚxdcadµÄaeoÄÇÀï¿´µ½µÄ,²»ÊÇÎÒµÄÔ­´´.ÌØ´Ë˵Ã÷
by the way,ÔÚmccadµÄ»ù´¡ÉÏ:
  1. (defun rnd(rMin rMax / e)
  2.    (vla-eval (vlax-get-acad-object) "Randomize : ThisDrawing.setVariable "USERR5" ,CDbl((Rnd))" )
  3.    (setq e (+ rMin (* (getvar "userr5")(- rMax rMin))) )
  4.    (if (= 'INT (type rmin)(type rmax))
  5.      (fix e)
  6.      e
  7.    )
  8. )
;;²âÊÔ:
(repeat 20 (print(rnd 3 7)))
(repeat 20 (print(rnd 3. 7)))
ÄúÐèÒªµÇ¼ºó²Å¿ÉÒÔ»ØÌû µÇ¼ | ×¢²á

±¾°æ»ý·Ö¹æÔò

СºÚÎÝ|ÊÖ»ú°æ|CADÂÛ̳|CAD½Ì³Ì|CADÏÂÔØ|ÁªÏµÎÒÃÇ|¹ØÓÚÃ÷¾­|Ã÷¾­Í¨µÀ ( ÔÁICP±¸05003914ºÅ )  
©2000-2023 Ã÷¾­Í¨µÀ °æȨËùÓÐ ±¾Õ¾´úÂ룬ÔÚδȡµÃ±¾Õ¾¼°×÷ÕßÊÚȨµÄÇé¿öÏ£¬²»µÃÓÃÓÚÉÌÒµÓÃ;

GMT+8, 2024-12-24 22:00 , Processed in 0.199899 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

¿ìËٻظ´ ·µ»Ø¶¥²¿ ·µ»ØÁбí