Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
AutoLISP (Vanilla / Visual) / Text to Speech
« Last post by mailmaverick on January 16, 2017, 02:30:30 am »
I came across a nice routine for converting Text to Speech in AuTOCAD :-

Code: [Select]
(defun TexttoSpeech (str)
  ;; Text to Speech
  ;; Source : http://forums.autodesk.com/t5/autocad-civil-3d-forum/extract-and-export-surface-contours-and-labels/td-p/3013632
  (vl-load-com)
  (setq sapi (vlax-create-object "Sapi.SpVoice"))
  (vlax-invoke sapi "Speak" str 0)
  (vlax-release-object sapi)
)
(defun c:test () (TexttoSpeech "Hello ....... ") (princ))
22
AutoLISP (Vanilla / Visual) / Re: Triangulation (re-visited)
« Last post by Topographer on January 15, 2017, 05:27:40 pm »
Any new update?
23
Thanks MP
Thanks roy_043

the code runs one time good but gives the same error
I animated the code gives error on 42 when editing lineweight.
Code - Auto/Visual Lisp: [Select]
  1.  (and lWgt (vla-put-LineWeight entVL (eval (read (strcat "acLnWt" lWgt)))))
24
On line 19 change:
Code: [Select]
(tblsearch "LTYPE" Nme)To:
Code: [Select]
(tblsearch "LAYER" Nme)
25
AutoLISP (Vanilla / Visual) / Re: List to create layer or midify exist create gives error
« Last post by MP on January 15, 2017, 02:38:18 pm »
mapcar is not the best tool for the task, foreach in concert with apply would be a more appropriate fit.

Code: [Select]
(foreach args

   '(
        ("A-GRID"      10 "CENTER2"    "015" T 0 "Planning")
        ("A-GRID-OUT"  21 "CENTER2"    "015" T 0 "Planning") 
        ("A-MTRL-FBRC" 20 "Continuous" "018" T 0 "Windows")   
    )       
   
    (apply 'lyrmk args)

)
26
AutoLISP (Vanilla / Visual) / List to create layer or midify exist create gives error
« Last post by HasanCAD on January 15, 2017, 01:48:55 pm »
Based on lee's code I created a lisp to create a layer if not exist and redfine if exist.
when run
Code - Auto/Visual Lisp: [Select]
  1. (lyrmk "test" 3 "Hidden" "018" t 30 "Test-Test")
the lisp work great put with mapcar and lambda gives error

The error
Code: [Select]
; error: ActiveX Server returned an error: Parameter not optional
Code - Auto/Visual Lisp: [Select]
  1. (DEFUN C:TEST ( / a b c d e f g)
  2.  (mapcar
  3.    '(lambda (a b c d e F G) (lyrmk a b c d e f g))
  4.    '("A-GRID" "A-GRID-OUT" "A-MTRL-FBRC") ; Name [Str]
  5.    '(10 21 20 ) ; Colours [Int]
  6.    '("CENTER2" "CENTER2" "Continuous") ; LineType [Str]
  7.    '("015" "015" "018" ) ; LineWeight [Str] 0.18 = "018"
  8.    '(T T T ) ; Plottable (T or nil)
  9.    '(0 0 0 ) ; Transperency (<0 tp 90>)
  10.    '("Planning" "Planning" "Windows")
  11.    )
  12.  )
  13.  
  14. (defun lyrmk (Nme Col lTyp lWgt Plt trns dsc / lay lyrs cmd) ;lee mac
  15.  ;http://www.cadtutor.net/forum/showthread.php?36882-Check-create-layer-issue-in-Lisp&p=243520&viewfull=1#post243520
  16.  (setq cmd (getvar 'cmdecho))
  17.  (setvar 'cmdecho 0)  
  18.  (if (not (tblsearch "LTYPE" Nme))
  19.    (progn
  20.      (setq lay (vla-add lyrs Nme))
  21.      (mdfy)
  22.    )
  23.    (progn
  24.      (mdfy)
  25.    )
  26.  )
  27.  (setvar 'cmdecho cmd)
  28. )
  29.  
  30. (defun lTload (lTyp)
  31.  (or (tblsearch "LTYPE" lTyp)
  32. lTyp
  33. "acad.lin")))
  34.  
  35. (defun mdfy (/)
  36.  (setq entVL (vlax-ename->vla-object (tblobjname "LAYER" Nme)))  
  37.  (and Col (vla-put-Color entVL Col))
  38.  (and lTyp (lTload lTyp) (vla-put-Linetype entVL lTyp))
  39.  (and lWgt (vla-put-LineWeight entVL (eval (read (strcat "acLnWt" lWgt)))))
  40.  (and (not Plt) (vla-put-Plottable entVL :vlax-false))
  41.  (and (setq LyrDs (vlax-put-property entVL 'Description dsc)))
  42.  (setq rtns (vl-cmdf "_.-layer" "_TR" trns Nme ""))
  43. )
27
AutoLISP (Vanilla / Visual) / (A1 blocks and A2 blocks) modify the block color
« Last post by well20152016 on January 15, 2017, 09:10:22 am »
(A1 blocks and A2 blocks) modify the block color
28
Your computer has a specific MAC address which you can get from following function :-
As an aside:
I find it strange that the parent 'external' object is not released in the function. I often have doubts about what to release (only the parent or all 'external' objects), but I would always release the parent object.
29
Thanks all for your value help.
30
AutoLISP (Vanilla / Visual) / Re: Point is Inside polyline (Now with Bulges)
« Last post by MP on January 15, 2017, 12:36:46 am »
Because ObjectDBX.

Because the point may not be an object but merely a test coordinate.

An aside, ssget is not reliable if the area of interest is not visible.
Pages: 1 2 [3] 4 5 ... 10