Senin, 31 Januari 2011

Knowledge detail

VBA Applications

Q: How can I create a VBA application with ZWCAD?
A: VBA (Visual Basic for Applications) has its own interface environment, and so to work with VBA in ZWCAD, open the VBA environment, as follows: From ZWCAD’s Tools menu, choose Macro and then VisualBasic Editor.
This opens Visual Basic program to display VBA environment window, known as IDE, which is short for “integrated development environment.”
A VBA project is a collection of code modules, classes and forms. A module is a program code segment, like a subroutine in traditional programming languages. A project contains one or more modules. Forms are user interface elements, such as dialog boxes and toolbar. Modules and forms run together to perform given functions.
You add a new modules by selecting Module from the Insert menu in the Visual Basic project window. This opens the module file editor window, in which you can write VBA programming code. The action also adds a new module icon (with the default name of Module1) to the module list in the Project window. 
 Note that ZWCAD continues to run while the VBA environment is open. This allows you to toggle between the VBA IDE and ZWCAD.
The following VBA program draws a donut with an inside diameter of 10 and outside diameter of 15:
 Sub DrawDonut()
       
    Dim CenterPt As New ZwcadPoint
    Dim OutRad As Double
    Dim InRad As Double
   
    CenterPt.x = 10: CenterPt.y = 10: CenterPt.z = 0
   
    OutRad = 15
    InRad = 10
   
    Dim pt1 As New ZwcadPoint
    Dim pt2 As New ZwcadPoint
    Dim pts As New ZwcadPoints
   
    pt1(0) = CenterPt(0) - InRad - Abs(OutRad - InRad) / 2
    pt1(1) = CenterPt(1)
    pt1(2) = 0
    pts.Add pt1(0), pt1(1), pt1(2), 0
   
    pt2(0) = CenterPt(0) + InRad + Abs(OutRad - InRad) / 2
    pt2(1) = CenterPt(1)
    pt2(2) = 0
    pts.Add pt2(0), pt2(1), pt2(2), 1
   
    Dim PolyObj As ZwcadLWPolyline
    Set PolyObj = ThisDocument.ModelSpace.AddLightWeightPolyline(pts)
    PolyObj.Closed = True
   
    For i = 0 To 1
        PolyObj.SetBulge i, 1
        PolyObj.SetWidth i, Abs(OutRad - InRad), Abs(OutRad - InRad)
    Next i
       
    PolyObj.Update
   
    ThisDocument.Regen
   
End Sub

Kamis, 27 Januari 2011

Knowledge detail

Migrating LISP Applications

Q: Can I migrate my LISP applications to from AutoCAD to ZWCAD?
A: You can run existing LISP applications in ZWCAD with little or no modification. ZWCAD uses the AppLoad command to easily load LISP programs.
You should, however, be aware of some differences between the LISP programming language used by AutoCAD and ZWCXAD. For instance, AutoCAD offers a total of 422 LISP functions, of which 242 for AutoLISP and 180 for Visual LISP. In comparison, ZWCAD offers a total of 301 LISP functions, of which 206 are equivalent to those in AutoLISP and 95 equivalent to Visual LISP.
While ZWCAD is highly compatible with AutoCAD’s LISP, some functions are not supported at all. Specifically, those in AutoCAD beginning with VL,VLAX, and VLR are not supported as well by ZWCAD. We are, however, making great progress on them.

Senin, 24 Januari 2011

Knowledge detail

LISP programming

Q: How so I create LISP applications?
A: The steps to write applications in LISP are as follows:
1. Open a text editor such as NotePad.
2. Write the LISP code in the text editor’s window.
3. Save the code in a file using the desired path and file name. Ensure the extension is SP.
4. Load and run LISP program in ZWCAD with the AppLoad command.
The following LISP program is an example. It creates a layer named “Test,” changes the layer’s color to green, and then draws a closed polyline on the layer.(defun C:testlisp (/)
  (setvar "cmdecho" 0)
  (command "-layer" "t" "test" "m" "test" "c" "green" "test" "l" "continuous"
   "test" "lw" "0.5" "test" "")
  (command "pline" "-2,-3,0" "6, 4, 0" "1, -10, 0" "-11, -9, 0" "-12, -1, 0" "-6, 2, 0" "-1, 7, 0" "c")
  (command "regen")
  (command "zoom" "e" "")
  (setvar "cmdecho" 1)
  (princ)
)

Knowledge detail

Customizing the toolbar and menu

Q: I want to add some toolbars and menu items to my copy of ZWCAD. How do I do that?
A: Solution: For this purpose, you are supposed to know something about menu script. You could use MENULOAD to load local menu file to existing basic menu files. Note that both the basic menu file and any local menu files are associated with a menu group name. After loading a local menu, you can customize the ZWCAD menu bar by adding and deleting pull-down menus and other elements.
  “Local menu” refers any menu files in addition to the basic menu file. Any documents can be used as basic menu or local menu, but for the convenient operating, proposed to use larger menu as basic menu file, and then load other smaller local menu files in the process of implementing the procedures. After loading menu group files, they can be uninstalled by groups; when there is only one group left, ZWCAD reverts to its default configuration. Users can make use of Regidit command’s Import function. For example, here folders are added to the path of ZWCAD2009 Eng:
  HKEY_CURRENT_USER\Software\Chinaweal Longteng\ZWCAD 2009 eng\Profiles\Default\Menu The default menu group is named with “Group 0”, and the first implemented menu group is named with “Group 1”, and so on. Make there is no conflict between your menu group name and former ones. Three kinds of menu files -- .mnu, .mns, and .icm -- can be imported through both the Customize and MenLoad commands. (MNU and MNS files are compatible with AutoCAD, while ICM files work with IntelliCAD and compatibiles.) When importing files, you should use editor to change the group name of the menu file to ZWCAD to distinguish it with the default group name. The XML toolbar file exported from ZWCAD program command can be imported thorugh the Customize command. (It cannot be imported through the MenuLoad command.) After loading a new menu file, right clicking the tool bar displays a shortcut menu that lists the names of currently-loaded toolbars and menus. If you wish to edit toolbar icons, you can do so in a development platform, such as Microsoft’s Visual Studio 6.0. Compile it to a *.dll file, and then rename the *.dll file with the name of the menu file. When loading the menu file, ZWCAD searches for the corresponding *.dll file in which the toolbar icons are located. Note that all of these files must be located in the installation directory of ZWCAD.

Jumat, 21 Januari 2011

Knowledge detail

Customize ZWCAD with Third-part Applications

Q: I have seen some useful applications which can be used by AutoCAD. I am wondering if they can be used with ZWCAD.
A: It depends on how they were written for AutoCAD. In some cases, they might work quite well with ZWCAD. See if you are able to obtain a demo version of the software from the developer, and then try running it on ZWCAD.
Generally speaking, ZWSOFT does not develop its own third-part application for industry. Instead, ZWSOFT develops ZWCAD as a CAD platform, and so ZWCAD provides a good set of APIs for our third-part developers, such as VBA, Lisp, and ZRX. We welcome developers all around the world to adapt their applications to ZWCAD. We provide instant technical support to help developers migrate their applications to ZWCAD.
We are not, however, able to decide or choose which programs will be added to ZWCAD; this decision is up to third-part developers. ZWSOFT will keep improving its APIs to attract more developers to ZWCAD. To learn more about our APIs, please download a 30-day demo copy of ZWCAD. After installing it, open the Developer Help documents.

Selasa, 18 Januari 2011

Knowledge detail

Choosing title blocks



Q: I want to choose a title block for my drawing. How do I do that?
A: You can choose from among several template files included with ZWCAD, as follows:
1. Right click the layout tab, and then choose From Template from the shortcut menu.
 2. In the dialog box, preview the title blocks in the available template files. 
3. Choose one that suits your needs, as illustrated below.


Minggu, 16 Januari 2011

Knowledge detail

Setting templates for drawings



Q: I want to reset the default template file used with the QNew command. How do I accomplish this?
A: You configure the default template path and file name for QNew in the dialog box displayed by the Config command. See figure below.
Click Browse, and then select the .dwt file you wish QNew to use.

Kamis, 13 Januari 2011

Knowledge detail

Controlling the Startup dialog box



Q: The Startup dialog disappeared. Can I recall it?
A: You can recall the Startup dialog box simply by entering Startup command.
Command: startup
New current value for STARTUP (Off or On) : on (Press Enter.)
When you create a new drawing, you will again see the Startup dialog box.

Minggu, 09 Januari 2011

Knowledge detail

Returning ZWCAD’s user interface to its default setting



Q: The menu bar and toolbar disappeared from ZWCAD. How do I get them back?
A: One method is to use the Customize command. Click the Reset button, and ZWCAD resets its user interface back to normal. (See figure below.)

Kamis, 06 Januari 2011

Knowledge detail

I can't Export my drawing?

Q: ZWCAD failed to export my drawing file, and I got this message: “The evaluation period is expired. To use ZWCAD without any limitations, please purchase a permanent license by contacting sales@zwcad.com.”
A: This message is displayed by trial versions of ZWCAD. The trial version disables the Export command. If you need to export files, purchase a permanent license by contacting sales@zwcad.com .

Rabu, 05 Januari 2011

Knowledge detail

Why does ZWCAD Fail to save files?

Q: ZWCAD failed to save my drawing file, and just displayed this message: “File save failed! Trail version does not support saving. File exceed 8000 objects! Please make sure that you have been authorized and registered correctly. For more information, please contact ZWCAD Software Co. Ltd!”
A: This message is displayed by trial versions of ZWCAD. The trial version is restricted to saving files with fewer than 8,000 objects. For example, when you create a drawing of 8,000 circles, it will not be saved. Note that the that the 8000-object limit includes table information, such as that of layers and blocks.
The trial version has other two limitations: the Export command is disabled and all plots contain a watermark. 

Selasa, 04 Januari 2011

Knowledge detail

What can I do if ZWCAD failed to open the drawing?

Q: ZWCAD failed to open one of my drawing files.
A: Instead of double-clicking the file to open it, try opening it through ZWCAD’s File menu: select Open, If the problem occurs only when you double-click the file name, then the problem is due to the manner in which Windows registers file extensions.

If the problem still happens when you attempt to open files from ZWCAD’s menu, then try the following solutions:
1.      The version of the drawing file may be higher than the version of the ZWCAD program you are using. For example, if you use ZWCAD 2009 to open a drawing file whose format is AutoCAD 2010, then you will get message illustrated below: “Error: I. Unable to open the requested file. Only drawing version 2.5 and higher are supported.” These drawing files cannot be opened by ZWCAD.
 2.      If the version is not the problem, then the audit and recover functions may be of help. When a drawing file is damaged, it may be possible to recover some or all of the data by using the following commands that find and correct errors.
 (1) Audit command:
From ZWCAD’s File menu, choose Drawing Utilities, and then Audit
This command reads the drawing file, and then provides a report on the state of the file, such as whether errors exist in the file’s content.
 (2) Recover command:
From ZWCAD’s File menu, choose Drawing Utilities, and then Recover
This command recovers damaged drawing files in DWG format only; DXF files can be recovering only after they are opened.

3.      Sometime a problem may occur when the name of the file conflicts with the regional language of the Windows operation system. The solution is to change the name of the file to a number or to a name using letters from the English alphabet.