CONTROLLING LAYERS AND LINETYPES in Word

Creator QR in Word CONTROLLING LAYERS AND LINETYPES

CHAPTER 6 CONTROLLING LAYERS AND LINETYPES
Drawing QR Code In None
Using Barcode drawer for Microsoft Word Control to generate, create QR-Code image in Word applications.
www.OnBarcode.com
Draw Barcode In None
Using Barcode printer for Word Control to generate, create Barcode image in Office Word applications.
www.OnBarcode.com
Checking for Existing Linetypes
Paint EAN-13 In None
Using Barcode printer for Office Word Control to generate, create EAN13 image in Office Word applications.
www.OnBarcode.com
DataMatrix Maker In None
Using Barcode encoder for Office Word Control to generate, create Data Matrix 2d barcode image in Office Word applications.
www.OnBarcode.com
In some situations your program must determine if an element is present in the collection. One way to do this is to search for the element while iterating the collection, as described earlier in the chapter. The following example gets a linetype name from the user and then checks for its existence by iterating the Linetypes collection: Public Sub CheckForLinetypeByIteration() Dim objLinetype As AcadLineType Dim strLinetypeName As String strLinetypeName = InputBox("Enter a Linetype name to search for: ") If "" = strLinetypeName Then Exit Sub ' exit if no name entered For Each objLinetype In ThisDrawing.Linetypes If 0 = StrComp(objLinetype.Name, strLinetypeName, vbTextCompare) Then MsgBox "Linetype '" & strLinetypeName & "' exists" Exit Sub ' exit after finding linetype End If Next objLinetype MsgBox "Linetype '" & strLinetypeName & "' does not exist" End Sub Unlike prior releases, in which linetype names were converted to uppercase, AutoCAD 2000 and later allow the names to be a mix of upper- and lowercase, although Linetype1 and LINETYPE1 will be treated as the same name. This sample uses a case-insensitive string comparison of strLinetypeName and each Linetype name to allow for capitalization differences. A second technique is to let AutoCAD perform the search for you. This is quite a bit more efficient because AutoCAD can internally determine if the element is present, and it eliminates sending unneeded elements to your program. AutoCAD will also handle the case-insensitive name comparison for you. To use this technique you must employ the VBA error handler. Like many AutoCAD ActiveX objects, the Linetypes collection uses run-time errors or exceptions to signal unexpected conditions. If an exception isn t handled, the calling program halts and displays an error message to the user. In this case, Linetypes will raise an exception if you attempt to access an unknown Linetype name. By detecting this exception, or more correctly the lack of the exception, your program is notified of the existence of the Linetype. The following example gets a linetype name from the user and employs AutoCAD to check for its existence: Public Sub CheckForLinetypeByException() Dim strLinetypeName As String Dim objLinetype As AcadLineType strLinetypeName = InputBox("Enter a Linetype name to search for: ") If "" = strLinetypeName Then Exit Sub ' exit if no name entered
Print UPC Symbol In None
Using Barcode encoder for Office Word Control to generate, create UPC-A Supplement 2 image in Microsoft Word applications.
www.OnBarcode.com
Make PDF417 In None
Using Barcode generation for Office Word Control to generate, create PDF-417 2d barcode image in Microsoft Word applications.
www.OnBarcode.com
CHAPTER 6 CONTROLLING LAYERS AND LINETYPES
UCC.EAN - 128 Creation In None
Using Barcode printer for Word Control to generate, create GTIN - 128 image in Microsoft Word applications.
www.OnBarcode.com
Create MSI Plessey In None
Using Barcode creation for Word Control to generate, create MSI Plessey image in Office Word applications.
www.OnBarcode.com
On Error Resume Next ' handle exceptions inline Set objLinetype = ThisDrawing.Linetypes(strLinetypeName) If objLinetype Is Nothing Then ' check if obj has been set MsgBox "Linetype '" & strLinetypeName & "' does not exist" Else MsgBox "Linetype '" & objLinetype.Name & "' exists" End If End Sub
Create Quick Response Code In None
Using Barcode maker for Software Control to generate, create Denso QR Bar Code image in Software applications.
www.OnBarcode.com
QR Code ISO/IEC18004 Generator In None
Using Barcode encoder for Word Control to generate, create QR-Code image in Word applications.
www.OnBarcode.com
Loading a Linetype
Code 3 Of 9 Reader In Visual Studio .NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
UPC Code Decoder In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Linetype definitions are stored in linetype library files, which are external to drawing files and have the extension .lin. Linetypes are loaded by name from library files into similarly named Linetype objects in the drawing. Once loaded into a drawing, a Linetype object has no more connection to the library file. I don t cover the creation and definition of linetypes here, because no methods exist for customizing linetypes programmatically, but you can take a look at the AutoCAD Customization Guide in the online help files for details on creating custom linetypes. It s interesting to note that you can create custom linetypes by writing a linetype definition file programmatically and then loading it. You can load a Linetype object into your drawing using the Load method shown in the following code and detailed in Table 6-3. Set LinetypeObject = LinetypesCollection.Load(LinetypeName, _ LinetypeFilename) Table 6-3. Linetype Load Parameter Specifications
Drawing Data Matrix ECC200 In Objective-C
Using Barcode creation for iPhone Control to generate, create DataMatrix image in iPhone applications.
www.OnBarcode.com
Barcode Scanner In Java
Using Barcode Control SDK for Eclipse BIRT Control to generate, create, read, scan barcode image in BIRT reports applications.
www.OnBarcode.com
Name
USS Code 128 Printer In VS .NET
Using Barcode drawer for .NET Control to generate, create ANSI/AIM Code 128 image in .NET applications.
www.OnBarcode.com
UCC-128 Printer In Java
Using Barcode encoder for Eclipse BIRT Control to generate, create EAN 128 image in BIRT applications.
www.OnBarcode.com
LineTypeName LinetypeFilename
Paint GS1-128 In None
Using Barcode creation for Microsoft Excel Control to generate, create GS1-128 image in Office Excel applications.
www.OnBarcode.com
QR Reader In .NET Framework
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Data Type
Generate Code-128 In Java
Using Barcode maker for Java Control to generate, create Code 128 Code Set B image in Java applications.
www.OnBarcode.com
Paint PDF-417 2d Barcode In Java
Using Barcode maker for Java Control to generate, create PDF-417 2d barcode image in Java applications.
www.OnBarcode.com
String String
Description
The name of the linetype The path and file name of the linetype library file
The AutoCAD default Linetype object definition file for standard linetypes is acad.lin. You can view the contents of this via the Linetype dialog box (click Format Linetype to bring it up) by clicking Load and browsing to the file (see Figure 6-3). You can also open a linetype definition file in any ASCII text editor such as Windows Notepad.
Copyright © OnBarcode.com . All rights reserved.