01 CCCS 14 Aug
01 CCCS 14 Aug
R. U. Kalyankar
Department of Mechanical Engineering
Class : FY M.Tech 2020-21
Semester : II
Course: Customization of CAD/CAM Software (CCCS)
Course Code: (PEC-PL 516 & PCC-DM-512)
Course Coordinator: Prof. R. P. Parvekar
Mr. R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 1
Customization of CAD/CAM Software (CCCS) (PEC-PL 516 & PCC-DM-512)
• What is CCCS?
• What is Customization?
Customization – Tailor-made
• The CAD/CAM software available in the market are general purpose software
(targets a broad set of requirements).
R. U. Kalyankar
• These software are not developed for particular user or particular task.
• The process of molding of the software for particular application to suite the
specific requirements of the customer/user is called customization of software.
• Custom software development is the process of designing, creating, deploying and
maintaining software for a specific set of users, functions or organizations.
R. U. Kalyankar
4. Inculcate the API in UG/NX and AutoCAD.
R. U. Kalyankar
ii. Algorithms and programs for modeling parts
3. Design and develop custom software for CAM applications using DBMS like
MS access, VFP, Oracle.
R. U. Kalyankar
• AutoCAD & NX UI Customization
• Unit III - Introduction to Programming for CCCS
• IDEs, APIs in CAD Software, General Purpose and System Dependent API,
Projects - Sample Projects, Objects, Methods And Properties, AutoCAD Object
Tree, Data types.
R. U. Kalyankar
Toolbars, Layers and Linetypes.
• Unit VI: Additional Topics in Programming for CCCS
• Dimensions, Annotations, Layout, Creating Tables, CAM Applications
development using DBMS and SQL Programming.
R. U. Kalyankar
edition (September 23, 2005).
• Marion Cottingham, Mastering AutoCAD VBA, Sybex; 1 edition (March 16,
2001).
• Lee Ambrosius, AutoCAD Platform Customization: User Interface, AutoLISP,
VBA, and Beyond, Sybex; 1 edition (April 27, 2015).
• Sham Tickoo, Customizing AutoCAD 2020, 13th Edition, CADCIM Technologies
(September 11, 2019).
• User Function Programming manuals for Unigraphics (Vol. 1, 2, 3).
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 8
Lectures and ISE – I & II
CCCS (PEC-PL 516) – Credits – 3 + 1
• Contact Hours - Th. (2 hrs. RUK + 1 hr. RPP) & Pr. (2 hrs. RUK)
CCCS (PCC-DM-512) – Credits – 3 + 2
• Contact Hours - Th. (2 hrs. RUK + 1 hr. RPP) & Pr. (2 hrs. RUK + 2 hrs.
RPP)
R. U. Kalyankar
ISE-I (20 Marks Before Mid)
• Presentations on syllabus topics
• Assignment's presentations
• Quizzes
ISE-II (20 Marks After Mid)
• Presentations on syllabus topics
• Assignment's presentations
• Quizzes
R. U. Kalyankar
• Autodesk Inventor Professional
• https://www.autodesk.com/education/edu-
software/overview?sorting=featured&page=2
• Opensource and free for education Software
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 11
Expectations from students and feedback related to Semester-I
•
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 12
Script Programming
Learning Objectives:
• Write script files and use the SCRIPT command to run script files.
• Use the RSCRIPT and DELAY commands in script files.
• Invoke script files when loading AutoCAD.
• Create a slide show.
R. U. Kalyankar
• Preload slides when running a slide show.
R. U. Kalyankar
• do the initial drawing setup,
• or plot a drawing to a predefined specification.
• Also used to automate certain command sequences that are used frequently in
generating, editing, or viewing a drawing.
• Script cannot access dialog boxes or menus.
• When commands that open the file and plot dialog boxes are issued from script
file, AutoCAD runs the command line version of the command instead of opening
the dialog box.
R. U. Kalyankar
What should be the extension/name of program file?
• .scr/filename.scr
How to write the code?
LINE
0,0
5,0
R. U. Kalyankar
prompts.
• E.g.
• ORTHO
• GRID
• SNAP
• LIMITS
• ZOOM
8/14/2021 SGGSIE&T, Nanded CCCS 16
Script Programming (Cont…..)
How to write the code?
Ex.01
ORTHO ON
;space is used to terminate a command or a prompt entry
;ORTHO ; comment line
R. U. Kalyankar
;ON same as line 01
GRID 2.0 GRID OFF
SNAP 0.5 SNAP ON
LIMITS 0,0 50,50
ZOOM ALL
SETVAR TEXTSIZE 0.125
LTSCALE 4.0
SETVAR DIMSCALE 4
R. U. Kalyankar
(a standard file selection dialog
box) is displayed. Enter the file
name of a script to run that
script.
R. U. Kalyankar
;Window option for selecting the objects that need to be edited
2.25,5.0
;Lower left corner
6.25,9.0
;Upper right corner
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 20
Unit III - Introduction to Programming for CCCS
• IDEs,
• APIs in CAD Software,
General Purpose and System Dependent API,
• Projects - Sample Projects,
• Objects, Methods And Properties,
R. U. Kalyankar
• AutoCAD Object Tree,
• Data types.
R. U. Kalyankar
optimize repetitive operations to make it more productive for your individual
needs.
R. U. Kalyankar
➢Access and set system values such as line-style and colour.
➢Create views.
➢Interact with the operator.
➢Output non graphical data to the graphics screen.
➢Dimension drawings.
R. U. Kalyankar
as System or Software Dependent API.
eg. AutoLISP for AutoCAD;
GRIP for UGNX;
Pro-Programming for Creo.
2. General Purpose API:
➢Widely used programming language that are common to every CAD/CAM
software, are called General Purpose API.
eg. C, C++, C#, Java, Visual Basic, Visual C++, Python, KF, etc
8/14/2021 SGGSIE&T, Nanded CCCS 24
Various APIs available in CAD software
Various APIs available in NX:
➢NX Open GRIP (SD)
➢NX Open C (GP)
➢NX Open C++ (GP)
➢NX Open Java (GP)
R. U. Kalyankar
➢NX Open .NET (C#) (GP)
➢NX Open Python (GP)
➢SNAP - Simple NX Application Programming (VBA) (GP)
R. U. Kalyankar
Various APIs available in AutoCAD:
➢AutoCAD VBA
➢AutoLISP (SD)
➢Visual LISP
➢ C API
➢C++ API
➢JavaScript
➢managed.NET
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 27
The VBAIDE
• VBA projects must be loaded into the VBA development environment before they
can be edited or used.
• Editing a VBA project is handled in the Visual Basic for Applications Integrated
Development Environment, or commonly known as the VBAIDE.
R. U. Kalyankar
• The VBAIDE is displayed by clicking Manage tab ----> Applications panel --->
Visual Basic Editor on the ribbon or entering VBAIDE at the AutoCAD Command
prompt.
• The VBAIDE contains a number of tools that are used to add and modify the
components of a loaded VBA project.
R. U. Kalyankar
familiar with:
R. U. Kalyankar
• Editor window – Provides access to the code of a component in a loaded VBA
project or the form editor for a UserForm.
• Toolbox window – Provides access to the controls that can be placed on a
UserForm.
• Object Browser – Provides a view into the libraries that are currently referenced
to a VBA project.
R. U. Kalyankar
• The first step in designing a UserForm is to set its properties, such as width and
height.
• You may set a UserForm’s properties at design time or at run time using code also.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 32
Setting UserForm Properties
• UserForm properties control a form’s physical
appearance.
• The UserForm.Caption property defines the
text that appears on the left-hand side of the
UserForm title bar, as shown in Figure
• The UserForm.Height and UserForm.Width
R. U. Kalyankar
properties control the initial UserForm height
and width, respectively,
• However, you may change these properties at
run time as demonstrated in the following
• example:
Private Sub UserForm_Activate()
UserForm1.Width = 200
UserForm1.Height = 150
End Sub
R. U. Kalyankar
index number for the control.
• For example, the first TextBox control will be named TextBox1 by default. You can rename
controls by modifying their Name property.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 35
Code
• Next, you’ll enter some code and see how to make this dialog box interface work. First, you need
to open the UserForm code module by selecting View ➤ Code or pressing F7.
• Or you may start by double-clicking the < Pick … command button and entering the code listed
here:
Private Sub cmdPick_Click()
Dim Point As Variant
On Error Resume Next
R. U. Kalyankar
'hide the UserForm
UserForm1.Hide
'ask user to select a point
Point = ThisDrawing.Utility.GetPoint(, "Select a point")
If Err Then Exit Sub
'assign values to appropriate textbox
txtX = Point(0): txtY = Point(1): txtZ = Point(2)
'redisplay the UserForm
UserForm1.Show
End Sub
8/14/2021 SGGSIE&T, Nanded CCCS 36
Run Sub/UserForm
• This is all the code you need to make this example work. Execute this example by
selecting Run ➤ Run Sub/UserForm or by pressing F5.
• Alternatively, you can run the example by clicking the Run toolbar button as
shown in Figure.
• This final bit of code allows you to exit your application gracefully:
R. U. Kalyankar
Private Sub cmdOK_Click()
Unload Me
End Sub
R. U. Kalyankar
place it on a UserForm.
R. U. Kalyankar
appears in Figure allows a selection from a standard
group of possible responses presented in a drop-
down list.
R. U. Kalyankar
• Also, you can’t type values into a ListBox control.
R. U. Kalyankar
You may have any number of CheckBox controls on a UserForm; each CheckBox
control’s checked state is independent of any other CheckBox control.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 42
ToolBox Controls (Cont…..)
• ToggleButton
• Use a ToggleButton control to enable an option and leave it that way until the user
depresses the button again.
• This control presents an on/off switch whose appearance changes depending on
whether or not the user has depressed it.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 43
ToolBox Controls (Cont…..)
• Frame
• The Frame control, shown in Figure, is a container for other controls, similar to
the UserForm.
• Controls placed within a Frame control will move when you move the Frame
control.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 44
ToolBox Controls (Cont…..)
• CommandButton
• Use CommandButton controls, shown in Figure, to allow users to signify that they
have made all the selections and text entries they want to make, and either want to
continue on with the application or want to cancel the operation.
• The most common use of this control is for Ok and Cancel button operations.
R. U. Kalyankar
• The following is the most common method of ending a running application:
Private Sub cmdOK_Click()
Unload Me
End Sub
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 46
ToolBox Controls (Cont…..)
• MultiPage
• The MultiPage control, shown in Figure, is similar to a UserForm.
• Each tab or page is separate from the others.
• For example, if you add a control to Page1, the same control doesn’t appear on
any other page. Nor is it a part of the UserForm.
R. U. Kalyankar
• The MultiPage control is similar to a Frame control in that when you move the
MultiPage control, all the controls contained within it move as well.
R. U. Kalyankar
decreases counting values within a TextBox
control.
• This control contains a slider bar indicating
its relative position to the minimum and
maximum values.
• The slider also allows the user to quickly
make very large changes to the value.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 49
ToolBox Controls (Cont…..)
• Image
• The Image control, shown in Figure, enables you to display pictures on your
UserForm.
• The following types of images are supported: *.bmp, *.cur, *.gif, *.ico, *.jpg, and
*.wmf.
R. U. Kalyankar
• With the Image control’s default event being Click, you could also use it as a
fancy CommandButton control with a picture.
R. U. Kalyankar
• Macros are great relief for those boring repetitive jobs we all have to do from time
to time.
R. U. Kalyankar
• UserForm modules (files with a .frm extension) contain a text description of your form,
controls placement, and property settings.
• They also include UserForm-level declarations of constants, variables, and procedures;
and event procedures.
• Standard Module
• Standard modules (files with a .bas extension) contain module-level declarations of
programmer defined data types, constants, variables, and public procedures.
• A standard module typically contains routines that don’t fit nicely into a class definition.
R. U. Kalyankar
Reference .dvb File (Project File)
• You can reference the code of another .dvb file in your current project.
• This feature lets you easily reuse code among several projects.
R. U. Kalyankar
• A VBA project stored in an AutoCAD drawing.
• Regular Document
• An AutoCAD drawing that does not contain VBA embedded projects.
• Smart Document
• An AutoCAD drawing that contains one or more VBA embedded projects.
• Current Project
• The project currently selected in the VBA IDE.
R. U. Kalyankar
• This application allows you to edit the code and forms in your project or copy code and forms from
other projects.
• It also allows you to set references to other application Object Models.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 56
AutoCAD VBA Project Terms Reference (Cont...)
Macros Dialog Box
• The Macros dialog box allows you to run, delete, and create new macros, and provides access to
the VBA project options.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 57
Finding Help on AutoCAD VBA
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 58
Overview of Objects, Properties, Methods, and Events
R. U. Kalyankar
that are coded with the application’s response to user events.
R. U. Kalyankar
needed to regenerate it.
• UserForm Objects: UserForm objects represent anything that’s included in the
graphical user interface (GUI).
• So, each time you drag and drop a control from the Toolbox, an object is created that
is an instance of that class of control.
• Objects are said to be instances of classes, and their properties, methods, and events
are said to be members of that class.
R. U. Kalyankar
• Variables are known by their data type, that is, the kind of data that they can store.
• The data type determines the amount of memory required to store the variable’s
value.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 62
Methods of Declaring Variables
• Implicit Declaration
• You don’t have to declare variables as a specific data type before you use them.
• If you use a variable without explicitly declaring it, Visual Basic creates a variable with
that name and assigns it the Variant data type.
• This is the largest data type available in terms of memory usage and could lead to
memory resource problems.
R. U. Kalyankar
• When you use an undeclared variable, accidentally misspelling the variable name creates
another undeclared variable.
• These kinds of errors can lead to poor performance and a lot of wasted time debugging
your code.
• Explicit Declaration
• To avoid the hazards mentioned, force Visual Basic to require that you declare all
variables before you use them.
• To do so, place the following line at the top of your code module:
Option Explicit
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 64
User Interaction and the Utility Object
• To program truly powerful AutoCAD applications and macros, you need to be able
to interact with the user.
• This chapter discusses the Utility object
• which contains a number of methods for obtaining user input via the AutoCAD
command line and graphics screen
R. U. Kalyankar
• such as picking points, entering distances and angles, and picking a single entity.
• Interface Methods
• Interface methods present and retrieve information from the user.
• This section discusses the various methods made available through AutoCAD’s
Utility object.
R. U. Kalyankar
• This is because modal forms maintain the application focus while they’re visible.
• As long as a modal VBA form is visible, there’s no way for the user to get to the
AutoCAD drawing or command window.
• UserForms can be modal or modeless only with AutoCAD 2002 and later versions.
• To set the UserForm to modeless operation --->
R. U. Kalyankar
• Ex.:
Public Sub TestPrompt()
ThisDrawing.Utility.Prompt vbCrLf & "This is a simple message"
End Sub
R. U. Kalyankar
• The InitializeUserInput method has this syntax:
UtilityObject.InitializeUserInput OptionBits[, KeywordList]
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 69
The InitializeUserInputMethod (Cont...)
• Keywords:
• Command line keywords give the user various options. For instance, if you use the
AutoCAD
• Draw toolbar’s rectangle command, you may either pick a point or use one of the
five keywords to choose another command:
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 70
The Get Methods
• The Get methods get specific types of data from the user.
• These methods make AutoCAD pause until the user supplies a value at the
command prompt or picks a point in the drawing window.
• If the user supplies the wrong type of data, such as typing a string when a number
is needed, AutoCAD displays a message at the command prompt that tells them to
reenter the data.
R. U. Kalyankar
1. The GetKeyword Method:
• The GetKeyword method gets a command line option from the user.
• You must call InitializeUserInput to establish the list of keywords before you use
this method.
• It returns the keyword the user entered exactly as the keyword list specified it.
• This method has the following syntax:
strUserKeyWordInput = Object.GetKeyword([Prompt])
R. U. Kalyankar
End With
Select Case strInput
Case "Line": ThisDrawing.SendCommand "_Line" & vbCr
Case "Arc": ThisDrawing.SendCommand "_Arc" & vbCr
Case "Circle": ThisDrawing.SendCommand "_Circle" & vbCr
Case Else: MsgBox "You pressed Enter."
End Select
End Sub
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 73
The GetXXX Methods (Cont.....)
• This example gets a string from the user, including spaces, and then displays it:
Public Sub TestGetString()
Dim strInput As String
With ThisDrawing.Utility
strInput = .GetString(True, vbCr & "Enter a string: ")
.Prompt vbCr & "You entered '" & strInput & “’ “
R. U. Kalyankar
End With
End Sub
R. U. Kalyankar
• Ex.:
Public Sub TestGetInteger()
Dim intInput As Integer
With ThisDrawing.Utility
intInput = .GetInteger(vbCr & "Enter an integer: ")
.Prompt vbCr & "You entered " & intInput
End With
End Sub
R. U. Kalyankar
• This method’s Prompt parameter, a string, is optional. Use it to specify a prompt for input.
• Ex.:
Public Sub TestGetReal()
Dim dblInput As Double
With ThisDrawing.Utility
dblInput = .GetReal(vbCrLf & "Enter an real: ")
.Prompt vbCr & "You entered " & dblInput
End With
End Sub
R. U. Kalyankar
• varUserPointInput = UtilityObject.GetPoint([BasePoint] [,Prompt])
• This method’s Prompt parameter, a string, is optional. Use it to specify a prompt for
input.
8/14/2021 SGGSIE&T, Nanded CCCS 77
The GetXXX Methods (Cont.....)
5. The GetPoint Method (Cont…)
• This example gets a point from the user and displays its coordinate values:
• Ex.:
Public Sub TestGetPoint()
Dim varPick As Variant
R. U. Kalyankar
With ThisDrawing.Utility
varPick = .GetPoint(, vbCr & "Pick a point: ")
.Prompt vbCr & varPick(0) & "," & varPick(1)
End With
End Sub
• This method raises exceptions for null input, keyword entry, and canceled input
R. U. Kalyankar
• This method has the following syntax:
• varUserCornerInput = UtilityObject.GetCorner(BasePoint [,Prompt])
R. U. Kalyankar
Dim varBase As Variant
Dim varPick As Variant
With ThisDrawing.Utility
varBase = .GetPoint(, vbCr & "Pick the first corner: ")
.Prompt vbCrLf & varBase(0) & "," & varBase(1)
varPick = .GetCorner(varBase, vbLf & "Pick the second: ")
.Prompt vbCr & varPick(0) & "," & varPick(1)
End With
End Sub
R. U. Kalyankar
because it’s more flexible.
• This method has the following syntax:
• dblUserDistanceInput = UtilityObject.GetDistance([BasePoint] [,Prompt])
R. U. Kalyankar
Dim dblInput As Double
Dim dblBase(2) As Double
dblBase(0) = 0: dblBase(1) = 0: dblBase(2) = 0
With ThisDrawing.Utility
dblInput = .GetDistance(dblBase, vbCr & "Enter a distance: ")
.Prompt vbCr & "You entered " & dblInput
End With
End Sub
R. U. Kalyankar
• It measures the angle counterclockwise with respect to the ANGBASE system
variable’s current value.
• This method has the following syntax:
• dblUserAngleInput = UtilityObject.GetAngle([BasePoint] [,Prompt])
R. U. Kalyankar
• Ex.:
Public Sub TestGetAngle()
Dim dblInput As Double
ThisDrawing.SetVariable "DIMAUNIT", acDegrees
With ThisDrawing.Utility
dblInput = .GetAngle(, vbCr & "Enter an angle: ")
.Prompt vbCr & "Angle in radians: " & dblInput
End With
End Sub
R. U. Kalyankar
• Each of the Add methods returns an object reference to the newly created entity, so
you must use the VBA Set operator if you want to assign this return to a variable.
• When you create or modify an entity, the changes to the drawing don’t display
until the Update method of that object, the Update method of the Application
object, or the Regen method of the Document object is called.
• In some cases, AutoCAD will update the display once your macro or program is
complete; however, it’s always safest to ensure the update takes place in your
code.
R. U. Kalyankar
5. AddPoint
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 87
The Circle Object
• You can create a Circle object by specifying the position of the center and the
radius, and using the AddCircle method:
• Set CircleObject = Object.AddCircle(CenterPoint, Radius)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 88
The Ellipse Object
• You use the AddEllipse method to create a fully closed Ellipse object. This method
takes three parameters:
• Set EllipseObject = Object.AddEllipse(CenterPoint, MajorAxis, RadiusRatio)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 89
Line Objects
• Demonstrates how to create the various line-shaped objects.
• The Line Object
• The LWPolyline Object
• The MLine Object
•
R. U. Kalyankar
The Polyline Object
• Polyline Arc Segments
• The Ray Object
• The Spline Object
• The XLine Object
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 91
The LWPolyline Object
• A lightweight polyline is a 2-D line consisting of straight and arced segments.
• It’s functionally similar to the legacy Polyline entity, but it’s internally represented
in a “flat” data structure as opposed to the tree-structured Polyline entity.
• This results in a more compact data size per entity and faster graphics
regeneration; hence the “lightweight” name.
R. U. Kalyankar
• You create a new LWPolyline object using the AddLightWeightPolyline method,
as follows:
• Set LWPolylineObject = Object.AddLightWeightPolyline(Vertices)
R. U. Kalyankar
• When you create an LWPolyline object, it’s open as shown in Figure.
• To close the polyline (i.e., to join the first vertex to the last), set its Closed
property to True.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 94
The Polyline Object
• The Polyline object is similar in function to the LWPolyline object, but it’s stored
in an alternate format.
• It’s a 2-D or 3-D line consisting of straight and arced segments, but the segments
are stored as distinct entities.
• A number of different polyline types are available;
R. U. Kalyankar
• the following list illustrates their AutoCAD command-line equivalent and a
description of each type:
• PLINE = 2D polyline (AcadPolyline)
• 3DPOLY = 3D polyline (Acad3DPolyline)
• 3DMESH (also EDGESURF, RULESURF, TABSURF, etc.) = N x M 3D mesh
(AcadPolygonMesh)
• PFACE = Irregular 3D mesh (AcadPolyfaceMesh)
R. U. Kalyankar
follows:
• Set PolylineObject = Object.AddPolyline(Vertices)
R. U. Kalyankar
• Although it’s less efficient for simple polyline representations, the Polyline object
has features not present in the lightweight form, such as the capability to represent
splines and other smoothly curved shapes.
• The following example allows the user to change a specified Polyline curve type
from the command line.
R. U. Kalyankar
• A positive bulge factor denotes a counterclockwise arc relative to the start and end
points of the polyline segment, and a negative bulge factor denotes a clockwise
arc.
R. U. Kalyankar
• Further, because the bulge factor is calculated using the segment’s start and end
points, the resulting arc is automatically scaled as the distance between these
points changes (e.g., when the user scales or grip-edits the polyline).
• To assign a bulge factor to the polyline segments, use the SetBulge method.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 100
The XLine Object
• The XLine object represents a straight line that passes through two specified
points and extends to infinity in both directions.
• You can use the AddXline method to create a new XLine object:
• Set XLineObject = Object.AddXline(FirstPoint, SecondPoint)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 101
The Spline Object
• The Spline object represents a nonuniform rational B-spline (NURBS) quadratic
or cubic curve.
• You use the AddSpline method to create a new Spline object:
• Set SplineObject = Object.AddSpline(FitPoints, StartTangent, EndTangent)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 102
The Region Object
• The Region object represents a bounded plane and may consist of Line, Arc,
Circle, Elliptical Arc, LightweightPolyline, and Spline objects.
• To create a Region object from a set of drawing entities, use the AddRegion
method as follows:
• RegionArray = Object.AddRegion(ObjectsArray)
R. U. Kalyankar
• AddRegion returns an array of the Region objects created from the ObjectsArray
parameter, as shown in figure.
R. U. Kalyankar
associated with the Hatch object.
• You set this property when you create the Hatch object, using the AddHatch
method.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 105
The Point Object
• Point objects can act as nodes to which you can snap objects. You can specify a
full 3-D WCS location for a point.
• You use the AddPoint method to create a new Point object, as follows:
• Set PointObject = Object.AddPoint(PointPosition)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 106
Creating 3-D Objects
• AutoCAD also provides you with a number of methods to programmatically
create complex 3-D solid entities.
• 3-D primitives (the box, cone, cylinder, sphere, torus, and wedge objects)
• Elliptical cones and cylinders
• Extruded and revolved solids
R. U. Kalyankar
• Manipulation of solids (slicing, checking interference, and spatial properties)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 108
The Cone
• You create a 3DSolid object in the form of a cone using the AddCone method.
• The base of the cone is parallel with the XY plane of the WCS.
• Set 3DSolidObject = Object.AddCone(ConeCenter, BaseRadius, Height)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 109
The Cylinder
• You add a cylinder to a drawing using the AddCylinder method.
• The base of the cylinder lies in a plane parallel to the WCS XY plane.
Set 3DSolidObject = Object.AddCylinder(CylinderCenter, Radius, Height)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 110
The Sphere
• You use the AddSphere method to create a 3DSolid object representing a sphere
and to add it to a drawing.
Set 3DSolidObject = Object.AddSphere(SphereCenter, Radius)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 111
The Torus
• Use the AddTorus method to create a torus and add it at a given point in a
drawing, such that the ring lays flat in the XY plane.
Set 3DSolidObject = Object.AddTorus(TorusCenter, TorusRadius, TubeRadius)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 112
The Wedge
• The AddWedge method creates a wedge with edges parallel to the WCS axes.
• Set 3DSolidObject = Object.AddWedge(FaceCenter, Length, Width, Height)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 113
Creating Elliptical 3-D Objects
• AutoCAD provides two methods for creating elliptical solids.
• The first creates an elliptical cone, and the second creates an elliptical cylinder.
The Elliptical Cone
• The AddEllipticalCone method creates a 3DSolid object in the form of an
elliptical cone whose base lies flat on the WCS XY plane.
R. U. Kalyankar
• The major axis of the ellipse may lie in either the X direction or the Y direction.
• Set 3DSolidObject = Object.AddEllipticalCone(ConeCenter, XLength, YLength,_
Height)
R. U. Kalyankar
Set 3DSolidObject = Object.AddEllipticalCylinder (CylinderCenter,_
XLength, YLength, Height)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 116
The Extruded Solid
• You create this solid by extruding a planar region along its Z-axis.
• You may extrude the region in a positive or negative direction, and you may taper
or expand it in the extrusion direction.
Set 3DSolidObject = Object.AddExtrudedSolid(Region, Height, TaperAngle)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 117
The Extruded Solid Along a Path
• You use the AddExtrudedSolidAlongPath method to create a new 3DSolid object
that represents the extrusion of a closed planar region along a given path.
• This path may take the form of a polyline, spline, circle, ellipse, or arc.
• The new solid is extruded from the current location of the region using the
translation of the path to the region’s Centroid.
• Set 3DSolidObject = Object.AddExtrudedSolidAlongPath(Region, Path)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 118
The Revolved Solid
• You add a 3DSolid object representing a revolved solid, which you create by
sweeping a planar region around an axis, to a drawing by using the
AddRevolvedSolid method.
Set 3DSolidObject = Object.AddRevolvedSolid(Region, AxisPoint, _
AxisDirection, Angle)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 119
Editing Solids
• You may combine and edit individual 3DSolid objects to form new, more complex
3DSolid objects.
• You may perform operations to combine solids, subtract one solid from another,
and find the common intersection between solids.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 120
Boolean Operations
• You perform the primary editing operations using the Boolean method.
• This method, whose name is derived from its algebraic nature, alters the solid
according to the Operation parameter.
3DSolidObject.Boolean(Operation, SolidObject)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 121
Editing Objects
• AutoCAD gives you plenty of methods and properties so you can edit drawing
objects, which you’d normally have to do in the AutoCAD interface.
• By employing these methods and properties, you can adapt and combine editing
tasks in macros and VBA applications as needed.
• This topic considers editing objects, first through their methods and then through
R. U. Kalyankar
their properties.
• Specifically, this chapter covers the following:
➢ Copying, deleting, exploding, highlighting, mirroring, moving, offsetting,
rotating, and scaling objects
➢ Working with polar and rectangular arrays
➢ Changing the color, layer, linetype, and visibility of objects
R. U. Kalyankar
• For each object against which you want to invoke a method, be sure that the object
supports the method you are using.
• Your best tools for this are error trapping and error handling.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 124
Deleting Objects
• To remove an object from a drawing, use the Delete method, which has the
following simple syntax:
• Object.Delete
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 125
Exploding Objects
• Use the Explode method to break a compound object into its subentities.
• It returns an array of objects that hold references to these subentities.
• This might mean breaking a block reference into its constituent drawing objects or a
polyline into its individual straight-line polylines.
• Block Insertions leave the original block object behind, and the resulting exploded set of
entities is actually a copy of each original nested entity in the Block Insertion.
R. U. Kalyankar
• To produce behavior similar to the AutoCAD EXPLODE command, also delete the
original Block Insertion entity.
• This method has the following syntax:
• varObjectArray = Object.Explode
• The Erase method is similar to the Delete method, except it erases only SelectionSet
groups. You can’t use it to delete objects.
• The 3DPoly, BlockRef, LightweightPolyline, MInsertBlock, PolygonMesh, Polyline,
Xref, and Region objects expose this method.
R. U. Kalyankar
• This method has the following syntax:
• Object.Highlight Highlighted
• This method’s Highlighted parameter, a Boolean, indicates whether to highlight the object
• (True) or not (False).
• The following example illustrates the Highlight method in action.
• It asks the user to choose a selection of objects from the drawing area.
• It then highlights and unhighlights each of these objects.
R. U. Kalyankar
• Note that the MIRRTEXT system variable has been set to 0.
• This setting mirrors text objects tothe appropriate place on the drawing, but does
not mirror the text itself, as shown in Figure
8/14/2021 SGGSIE&T, Nanded CCCS 128
Mirroring Objects (Cont…)
• Note that the MIRRTEXT system variable has been set to 0.
• This setting mirrors text objects to the appropriate place on the drawing, but does
not mirror the text itself, as shown in Figure
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 129
Mirroring Objects (Cont…)
• Use the Mirror3D method to reflect an object in a plane, where the new object lies
outside the plane of the original object.
• Set DrawingObject = DrawingObject.Mirror3D(PlanePoint1, PlanePoint2,
PlanePoint3)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 130
Moving Objects
• Use the Move method to perform three-dimensional translations on drawing
objects.
• Thismethod has the following syntax:
• DrawingObject.Move Point1, Point2
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 131
Rotating Objects
• Use the Rotate method to rotate a drawing object around a given point in the User
Coordinate System’s (UCS) XY plane.
• This method has the following syntax:
• DrawingObject.Rotate BasePoint, RotationAngle
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 132
Rotating Objects (Cont…)
• Use the Rotate3D method to perform a three-dimensional rotation of an object
around an axis.
• This method has the following syntax:
• DrawingObject.Rotate3D AxisPoint1, AxisPoint2, RotationAngle
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 133
Scaling Objects
• The ScaleEntity method scales a drawing object uniformly in all directions around
a base point.
• This method has the following syntax:
• DrawingObject.ScaleEntity BasePoint, ScaleFactor
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 134
Offsetting Objects
• The Offset method creates a new object with boundaries offset a specified distance
from an existing object’s boundaries.
• You can apply this method to the Arc, Circle, Ellipse, Line, LightweightPolyline,
Polyline, Spline, and Xline objects.
• This method returns an array of the newly created object(s).
R. U. Kalyankar
• varObjectArray = Object.Offset(OffsetDistance)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 136
Creating a Polar Array of Objects
• A polar array is a pattern of drawing objects lying on an arc’s path.
• The ArrayPolar method creates a polar array, placing a specified number of objects
over an angle.
• It returns an array of the new objects.
• varObjectArray = DrawingObject.ArrayPolar (NumberofObjects, _
R. U. Kalyankar
AngleToFill, ArrayCenter)
R. U. Kalyankar
• varObjectArray = DrawingObject.ArrayRectangular (NumberOfRows, _
NumberOfColumns, NumberOfLevels, DistBetweenRows, _
DistBetweenColumns, DistBetweenLevels)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 139
Creating Linetypes
After completing this topic, you will be able to:
• Write linetype definitions.
• Create different linetypes.
• Create linetype files.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 140
Creating Linetypes (Cont….)
Standard Linetypes:
• The AutoCAD software package comes with a library of standard linetypes that
has different linetypes, including ISO linetypes.
• These linetypes are saved in the acadiso.lin file.
• You can modify existing linetypes or create new ones.
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 141
Creating Linetypes (Cont….)
Linetype Definition:
• Consist of two parts:
Header line and pattern line
Header Line:
• The format of the header line is:
R. U. Kalyankar
*Linetype_Name, Description
• Ex.
*HIDDENS, - - - - - - - - - - - - - - - -
• Pattern Line:
• The format of the pattern line is:
Alignment field specification, Linetype specification
• Ex. A,.75,-.25,.75
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 143
•
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 144
Control Structures
• Control your application’s flow and execution.
• Without control structures, your application would run from top to bottom.
• Decision Structures
• Decision structures let you test the condition, value, or state of a variable and perform
operations based on the test’s result.
R. U. Kalyankar
• If ... Then
• Use an If ... Then statement to conditionally execute one or more other statements. The
• If ... Then statement is used either in this way:
• If <condition> Then <statement>
• or in this way:
• If <condition> Then
• <statements>
• End If
R. U. Kalyankar
If Count < 20 Then Count = Count + 1
• To execute more than one statement after the conditional test, write it like this:
If Count < 20 Then
Count = Count + 1
Application.Visible = False
End If
The multiple-line version of the If ... Then statement requires that you end the statement
• with the End If keywords.
R. U. Kalyankar
Else If
<statement block 2>
Else
<statement block 3>
End If
R. U. Kalyankar
• Subtype2
• Type2:
• Subtype1
• Subtype2
• Data entry of parameters are possible.
• Readymade input (Data can be selected from connected standard
tables/spreadsheets).
• Automatic reports can be generated.
8/14/2021 SGGSIE&T, Nanded CCCS 148
Custom Tool Requirement Analysis related to CAD (Cont..)
• Bearings
a. Design calculations
b. Design of any standard in the world can be quickly modeled (ISO, DIN,
HASCO, etc)
c. Can be model following types of bearings,
R. U. Kalyankar
• Ball Bearings:
• Subtype1
• Subtype2
• Radial Bearings:
• Subtype1
• Subtype2
R. U. Kalyankar
• In this topic you’ll learn how to create dimensions and annotations and add them
to your drawings.
• You’ll also see how to set up and use different text and dimension styles.
R. U. Kalyankar
appearance of dimensions, leaders, and geometric tolerances.
R. U. Kalyankar
DimStyles collection.
Set DimStyleObject = DimStylesCollection.Add(DimStyleName)
R. U. Kalyankar
AutoCAD drawing.
• The AddDimXYZ methods used to add dimensions to drawings are exposed by the ModelSpace,
PaperSpace and Block objects.
R. U. Kalyankar
Set DimAlignedObject = Object.AddDimAligned(Point1, Point2, _
TextPosition)
R. U. Kalyankar
Point1, Point2, TextPosition)
R. U. Kalyankar
Set DimAngularObject = Object.AddDimAngular(Vertex, Point1, Point2,_
TextPosition)
R. U. Kalyankar
ChordPoint2, LeaderLength).
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 167
Creating Dimensions (Continued)
The DimRotated Object
• The DimRotated object measures the length of the projection of a line onto a
direction specified by an angle from the X-axis.
Set DimRotatedObject = Object.AddDimRotated(Point1, Point2, _
DimLocationPoint, RotationAngle)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 168
Using the Tolerance Object
• The Tolerance object represents a geometric tolerance in a feature control frame.
• Tolerances specify allowable deviations of orientation, location, and so on, from
the exact geometry of a drawing.
Set ToleranceObject = Object.AddTolerance(Text, InsertionPoint, _
TextDirection)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 169
Using the Tolerance Object (Continued)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 170
Using the Tolerance Object (Continued)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 171
Using the Leader Object
• A Leader object consists of an arrowhead attached to a spline or to straight-line
segments.
• You can use this object to associate text with a drawing object.
• To add a Leader object to your drawing, use the AddLeader method.
Set LeaderObject = Object.AddLeader(PointsArray, Annotationtype,
R. U. Kalyankar
ArrowType).
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 173
Layers
• A layer is a property of every AutoCAD drawing object.
• By using multiple layers, you may organize drawing data into logical categories.
• For example, when you design an office layout, you could use one layer to
display the walls and other fixed structural objects, and you could use other
layers to show the potential furniture or electrical arrangements.
R. U. Kalyankar
• Alternatively, you could use a layer to hold dimensions (measurement
annotations) or hidden lines.
• A Layer object represents one of these logical groupings.
• Manipulating the state of layers makes it easier to manage complex drawings.
• For example, by making a layer visible or hidden, the user can choose to work
with specific entity categories without being overwhelmed by all the other
drawing entities.
R. U. Kalyankar
• In the following code, ThisDrawing is used as the active document:
Dim objLayers As AcadLayers
Set objLayers = ThisDrawing.Layers
R. U. Kalyankar
For Each objLayer In ThisDrawing.Layers ' iterate layers
If 0 = StrComp(objLayer.name, strLayername, vbTextCompare) Then
MsgBox "Layer '" & strLayername & "' exists"
Exit Sub ' exit after finding layer
End If
Next objLayer
MsgBox "Layer '" & strLayername & "' does not exist"
End Sub
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 177
The following example retrieves a layer name from the user and
attempts to add it to the Layers collection:
Public Sub AddLayer()
Dim strLayerName As String
Dim objLayer As AcadLayer
strLayerName = InputBox("Name of Layer to add: ")
If "" = strLayerName Then Exit Sub ' exit if no name entered
On Error Resume Next ' handle exceptions inline
'check to see if layer already exists
R. U. Kalyankar
Set objLayer = ThisDrawing.Layers(strLayerName)
If objLayer Is Nothing Then
Set objLayer = ThisDrawing.Layers.Add(strLayerName)
If objLayer Is Nothing Then ' check if obj has been set
MsgBox "Unable to Add '" & strLayerName & "'"
Else
MsgBox "Added Layer '" & objLayer.Name & "'"
End If
Else
MsgBox "Layer already existed"
End If
End Sub
R. U. Kalyankar
settings are shown.
R. U. Kalyankar
DocumentObject.ActiveLayer = LayerObject
• The following code makes the layer named “Walls” the active layer for the current
Document:
ThisDrawing.ActiveLayer = ThisDrawing.Layers("Walls")
• New entities will now be placed on the “Walls” layer until another layer is made active.
• You can change the layer of existing entities by altering the Layer property of that
particular entity.
• The Layer property is a string that corresponds to the name of a Layer object.
R. U. Kalyankar
LayerObject.LayerOn = blnLayerOn
• A value of True for this property will turn the layer on.
• Conversely, a value of False will turn the layer off.
• Setting the Freeze property to True will freeze a layer, whereas setting it to False
will thaw the layer.
• For example, the following freezes a specific Layer object:
objLayer.Freeze = True
R. U. Kalyankar
Layer object.
• Setting it to True enables it to be processed for plotting.
• Setting it to False treats it as though it has been frozen with respect to plot output.
objlayer.Plottable = False
• Deleting a Layer
• The Layer.Delete method removes a Layer object from the Layers collection.
• This method takes no parameters and has no return value:
LayerObject.Delete
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 183
Layer Linetypes
• The Layer.Linetype property is a string that you can access as follows:
Public Sub Layer0Linetype()
Dim objLayer As AcadLayer
Dim strLayerLinetype As String
Set objLayer = ThisDrawing.Layers("layer4")
R. U. Kalyankar
objLayer.Linetype = "Continuous"
strLayerLinetype = objLayer.Linetype
End Sub
R. U. Kalyankar
library file.
• No methods exist for customizing linetypes programmatically
• Set LinetypeObject = LinetypesCollection.Load(LinetypeName, _
LinetypeFilename)
R. U. Kalyankar
On Error Resume Next ' handle exceptions inline
ThisDrawing.Linetypes.Load strLinetypeName, "acad.lin"
If Err Then ' check if err was thrown
MsgBox "Error loading '" & strLinetypeName & "'" & vbCr & _
Err.Description
Else
MsgBox "Loaded Linetype '" & strLinetypeName & "'"
End If
End Sub
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 187
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 188
UserForms
• The UserForm object is the canvas upon which you visually design your
application, and it provides the windows your users interact with when they run
the application.
• UserForms have their own properties, methods, and events you can use to
control their appearance and behavior.
R. U. Kalyankar
SGGSIE&T CCCS
Inserting a user Form:
R. U. Kalyankar
SGGSIE&T CCCS
ActiveX Controls:
R. U. Kalyankar
SGGSIE&T CCCS
AutoCAD UserForm Events:
• Events occur as a result of actions happening while your program is running, such
as opening or saving a drawing. They allow you to write source code that will
execute whenever that event occurs.
• Messages such as “Would you like to save changes?” are the common results of a
user action that has triggered an event.
R. U. Kalyankar
SGGSIE&T CCCS
List of Events
R. U. Kalyankar
SGGSIE&T CCCS
Click Event
Private Sub cmdPick_Click()
Dim Point As Variant
On Error Resume Next
'hide the UserForm
UserForm1.Hide
'ask user to select a point
Point = ThisDrawing.Utility.GetPoint(, "Select a point")
R. U. Kalyankar
If Err Then Exit Sub
'assign values to appropriate textbox
txtX = Point(0): txtY = Point(1): txtZ = Point(2)
'redisplay the UserForm
UserForm1.Show
End Sub
SGGSIE&T CCCS
Setting UserForm Properties
R. U. Kalyankar
Ex. Private Sub UserForm_Activate()
UserForm1.Width = 200
UserForm1.Height = 150
End Sub
SGGSIE&T CCCS
Label Activate Event
Ex.:
R. U. Kalyankar
End Sub
SGGSIE&T CCCS
Key Up Event on Textbox
• The following example waits until the user presses the Enter
key, and then prints the text entered in a standard Visual Basic
MsgBox dialog box:
Ex.:
R. U. Kalyankar
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = 13 Then
MsgBox "You entered: " & TextBox1.Text
End If
End Sub
SGGSIE&T CCCS
Combo Box Control
Ex.:
R. U. Kalyankar
.AddItem "Item 2"
.AddItem "Item 3"
End With
End Sub
SGGSIE&T CCCS
Option Button
• Also known as Radio Buttons.
Ex.:
Private Sub OptionButton1_Click()
MsgBox "OptionButton1"
End Sub
R. U. Kalyankar
Private Sub OptionButton2_Click()
MsgBox "OptionButton2"
End Sub
SGGSIE&T CCCS
Toggle Button
Ex.:
R. U. Kalyankar
MsgBox "ToggleButton1 is Off"
Case True
MsgBox "ToggleButton1 is On"
End Select
End Sub
SGGSIE&T CCCS
Controlling Menus and Toolbars
• AutoCAD 2000 (and higher) gives you the ability to control the menus and
toolbars programmatically.
• You can manipulate existing menus or create new entries using the objects
exposed by the AutoCAD object model.
• Although you can’t create a completely new menu structure programmatically,
R. U. Kalyankar
you can make changes to the existing menus.
• I will start this topic with the MenuGroups collection because it’s the parent object
of the MenuGroup object, which in turn is the parent object of the ToolBars and
PopupMenus collections.
• The MenuBar collection holds all the PopupMenu objects that are currently
displayed in the AutoCAD menu bar.
R. U. Kalyankar
available within an AutoCAD session.
R. U. Kalyankar
• Using the Load method with the BaseMenu parameter set to True equates to executing the
MENU command inside the AutoCAD application and selecting a file through the Select
Customization File dialog box.
• Alternatively, you can execute the MENULOAD or CUILOAD command and check the
Replace All option in the Menu Customization dialog box.
• The newly loaded menu file becomes the only loaded menu group and completely
replaces the previous menu bar.
R. U. Kalyankar
• PopupMenuObject.InsertInMenuBar(Index)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 205
The AddTable Method
• You can create a Table object by specifying the insertion point, number of rows,
number of columns, row height, and column width using the AddTable method.
• Set TableObject = Object.AddTable(InsertionPoint, NumberOfRows, _
NumberOfColumns, RowHeight, ColumnWidth)
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 206
The RegenerateTableSuppressed Property
• The RegenerateTableSuppressed property specifies whether the table will be
repainted each time a change to the table is made.
object.RegenerateTableSuppressed
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 207
The GetText Method
• Text within a Table can be read using the GetText method to retrieve the text string
value of a specified row and column of an existing table.
• The GetText method returns a string and has the following syntax:
object.GetText Row, Column
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 208
The SetText Method
• Use the SetText method to set the text string value of a specified row and column
of an existing table.
• The SetText method returns nothing but has the following syntax:
object.SetText Row, Column, Text
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 209
The GetTextHeight Method
• Use the GetTextHeight method to retrieve the row height of a specific type of row.
• The GetTextHeight method returns the height of the row type specified and has the
following syntax:
object.GetTextHeight RowType
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 210
The InsertRows Method
• Use the InsertRows method to insert additional rows in an existing table.
• Note: Rows are inserted before the row index provided as a parameter to this
method.
• The method returns nothing but has the following syntax:
object.InsertRows Index, RowHeight, Rows
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 211
The InsertColumns Method
• Use the InsertColumns method to insert additional columns in an existing table.
• Note: Columns are inserted before the column index provided as a parameter to
this method.
• The method returns nothing but has the following syntax:
• object.InsertColumns Index, ColumnWidth, Columns
R. U. Kalyankar
8/14/2021 SGGSIE&T, Nanded CCCS 212
R. U. Kalyankar
Thank You
8/14/2021 SGGSIE&T, Nanded CCCS 213