určí bod z výchozího bodu, vzdálenosti a úhlu v radiánech
(itoa <number>)
(itoa 10)
vrátí číslo jako string
(ssget)
(ssget „x“)
nechá vybrat objekty (s „x“ vybere vše v modelu)
(sslength <sset>)
(sslength ssget1)
udá počet prvků ve výběru
(ssname <sset> <index>)
(ssname sset 0)
vrátí jméno n-tého prvku (dle indexu – od nuly)
(wcmatch <string> <pattern>)
(wcmatch txtCont „*.*“)
bude true, pokud bude řetězec obsahovat nějaký znak
(foreach <sublist> <list>)
(foreach sublist list)
provede pro každý prvek listu
(strcase <string>)
(strcase „pokus“)
vrátí string velkými písmeny (POKUS), pokud doplním t bude malými
(strlen „string“)
(strlen „pokus hokus“)
vrátí počet znaků ve stringu (11)
(strcat <str1> <str2>)
(strcat „pokus“ “ “ „hokus“)
spojí stringy („pokus hokus“)
(substr <str> <start> <number>)
(substr „pokus hokus“ 7 5)
vrátí řetězec určený startem a počtem znaků (hokus)
(getstring <cr> <msg>)
(getstring T „zadej string: „)
zadá výzvu pro vložení stringu (pokud je parametr T může být i mezera, musí ukončit entrem)
Příklady
(setq eName (car (entsel))) ;do eName umístí jméno vybraného objektu
(setq eData (entget eName) ;do eData umístí dxf data objektu
(setq ssget1 (ssget "x" (list (cons 0 "text")))) ;vybere všechny texty
(sslength ssget1) ;vrátí počet
(command "chprop" txt "" "c" "1" "") ;změní barvu textu na červenou
Cykly
IF
(if (<cond>) (<command true>)(<command false>))
PROGN
(if (= r 0)
(progn
(<command1>)
(<command2>)
)
(<elseCommand>)
)
COND
(cond
((= n 1) (allert "RED"))
((= n 2) (allert "BLACK"))
((= n 3) (allert "YELLOW"))
((= n 4) (allert "GREEN"))
(t (alert "mimo rozsah"))
)
WHILE LOOP
(while (<condition>)
st1
st2
st3
)
Užitečné příkazy
_BATTMAN
sesynchronizuje původní obsah atributů referencí bloku s novou podobou bloku
_ATTSYNC
synchronizace nové podoby bloků
VBA from Autocad to ZWCAD
Copy all codes in Thisdrawing from AutoCAD to ZWCAD Tips: if your VBA contains Classes, modules or forms, please export it in AutoCAD and then import to ZWCAD
Change entities type from AcadXXX to ZcadXXX, for example, AcadLayer →ZcadLayer, IAcadLWPolyline→IZcadLWPolyline Tips:you can just replace all “Acad” with “Zcad”
Change AcadAcCmColor to ZcadZcCmColor.
Change all the entity declaration from acXXX to zcXXX, for example acRed →zcRed,AcadAcCmColor to ZcadZcCmColor Tips: Please keep the Objectname the same as that in AutoCAD, such as AcDbLine must be kept.
If when launch the program a message box pops up with message “Compile error: The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with PtrSafe attribute.”, please change Declare to Declare PtrSafe in the declaration of the functions and subroutines when shows the error, and change Long to LongLong in parameter and return value.
Napsat komentář
Pro přidávání komentářů se musíte nejdříve přihlásit.