Professional Documents
Culture Documents
Arx Training 2012
Arx Training 2012
Arx Training 2012
c
c
c
c c
c
cc c
c
c
c
cc
c
c
c
d
1.0
02/01/2012
First draft
-1-
c
-c Ti liu ARX Training l ti liu lu hnh ni b ti phng phn mm k thut
thuc Cng ty c phn cng ngh phn mm Hi Ha. Mi s sao chp, ph
bin ti liu m khng c quyn ca tc gi u l vi phm.
-c Ti liu c dng o to sinh vin thc tp, ngi mi vo lm ti phng
phn mm k thut trong cc kha ngn hn do cc lnh o phng t t chc.
-c Ti liu c bin xon v s dng v s dng vi cun sch Programming
AutoCAD 2000 Using ObjectARX
-c Yu cu lp trnh trn VC2008.
-c Yu cu s dng code standard (C php Hungary...)
c Tn class Bt u vi ch C tn file
c Bin thnh vin ca mt class bt u vi m_
c Bin static bt u vi s_
c Bin global bt u vi g_
c Xc nh kiu trong tn bin : m_n, m_d, m_p,
c Cc hm t nh ngha bt u bng ch in thng : getValue(), set,
c T l comment trn code t ti thiu 30%
c Yu cu comment header (u class, u hm)
c Vit code r rng, d c,
c Bin cn c khi to trc khi s dng
c Cn kim tra k iu kin trc khi thc hin (con tr)
-2-
c
CHNG I: BASIC ....................................................................................................... 4c
1. Startup..................................................................................................................... 4c
1.1 - Project Setting ................................................................................................. 4c
1.2 - Load/Unload ................................................................................................... 4c
1.3 - Entry Point ...................................................................................................... 4c
1.4 - Message .......................................................................................................... 5c
2. Geometry ................................................................................................................ 7c
2.1 - Point ................................................................................................................ 7c
2.2 - Vector ............................................................................................................. 7c
2.3 - Matrix ............................................................................................................. 7c
3. Input/Output ............................................................................................................ 8c
3.1 - Input Value ..................................................................................................... 8c
3.2 - Select Object ................................................................................................... 8c
3.3 - Output ............................................................................................................. 8c
4. Symbol Table .......................................................................................................... 9c
4.1 Sysbol Table ................................................................................................... 9c
4.2 New Symbol ................................................................................................... 9c
4.3 - Assess Symbol ................................................................................................ 9c
4.4 - Delete Symbol ................................................................................................. 9c
4.5 - Iterator ............................................................................................................ 9c
5. Entity .................................................................................................................... 10c
5.1 Add Entity to database .................................................................................. 10c
5.2 Edit Entity .................................................................................................... 10c
5.3 Entities .......................................................................................................... 10c
6. Bi Tp ................................................................................................................. 11c
6.1 Bi 1 ............................................................................................................. 11c
-3-
cc cc
ccc c
Step 1
From Microsoft Visual Studio 8.0. Select File/New/Project
Step 2
Select ObjectARX/DBX/OMF Project from Templates.
Step 3
Continue edit settings of project or Finish to new project.
- Select ObjectARX or ObjectDBX
- Select No MFC support or Extension DLL using MFC Share DLL.
Step 4
Add more settings to project.
- C/C++: Additional Include Directories: add paths to directory contains header
files of ObjectARX. Add common path and path for win32 or x64 path.
- Linker: Output File Name The name of file after built with extension is .ARX
- Linker: Additional Library Directories: add paths to directory contains library
files of ObjectARX. Add path for win32 or x64 path.
- Linker: Additional Deferencies: The library file
c
cc !"#$ !c
c
c Load from APPLOAD or ARX command in AutoCAD.
c Load from AutoLISP with function (x x).
c Load from another arx application with x
x
or
function xx x.
c Load from acad.rx file. AutoCAD load arx automatic when it start
i c
c From APPLOAD or ARX command in AutoCAD.
c From AutoLIPS with function x x.
c from another arx application with x
x
or
function xx x.
%cc&c c
The ObjectARX Application require contain function
with declare
to another application callable (In this case is AutoCAD).
-4-
c
!
"
## $$$
%
&"
'
&
()
'
c
'cc(
c
c
kInitAppMsg
kUnloadAppMsg
kOleUnloadAppMsg
kLoadDwgMsg
kUnloadDwgMsg
kInvkSubrMsg
kEndMsg
kPreQuitMsg
kQuitMsg
kSaveMsg
kNullMsg
...
c
c
c c
c
c
c
+
a command by call function:
*
&
*
+&,
+"
",
-
",
./
0"
0&
%&
+ i
a command or a group command by methods:
-5-
c
*
&
*
+&,
+"
",
*
&
*
+&
&,
-6-
cc c
AcGePoint2d
AcGePoint3d
cc)c
AcGeVector2d
AcGeVector3d
%cc( *c
AcGeMatrix2d
AcGeMatrix3d
-7-
%cc+,c) $,c
acedInitGet
acedGetInt
acedGetReal
acedGetString
acedGetDist
acedGetPoint
acedGetCorner
acedGetAngle
acedGetOrient
acedGetKword
%cc$c-c
acedEndSel
acedSSGet
%%cc,+,c
acutPrompt
acutPrintf
acedAlert
-8-
'c.c
-$c -$c
+ AcDbLayerTable
+ AcDbBlockTable
+ AcDbTextStyleTable
+ AcDbLinetypeTable
+ AcDbDimStyleTable
+ AcDbUCSTable
+ AcDbViewTable
+ AcDbViewportTable
+ AcDbRegAppTable
'c.c/c0-$c
+ Get current database acdbCurDwg()
+ Open symbol table for write
+ New a symbol table record (Layer, View, Ucs)
+ Set name
+ Set properties
'%cc
c0-$c
+ Get current database acdbCurDwg()
+ Open symbol table for read/write
Process(get/set)
+ Close record
+ Close table
''cc1$c0-$c
+ Open symbol for write from Id
+ Call erase function
+ Close symbol
'2cc c
-9-
2c.c !!c& cc! -
c
+ New an entity of a class inherit from AcDbEntity
+ Set properties (Layer, Color,)
+ Set location
c
2c.c&! c& c
+ Select entity from drawing acedEntSel/acedSSGet
+ Get Id
+ Open entity from Id for read/write
+ Get/set properties
+ Get/set location
+ Close entity
2%c.&
c
+ AcDbLine
+ AcDbCircle
+ AcDbArc
+ AcDbEllipse
+ AcDbPolyline
+ AcDb2dPolyline
+ AcDb3dPolyline
+ AcDbSpine
+ AcDbText
+ AcDbMText
+ AcDbHatch
+ AcDbBlockReference
+ AcDbDimension
- 10 -
w
wc.c3 cc
+ To mt ARX Project s dng kiu ObjectARX
+ To mt Command: CTLAY
- To mt layer mi vi tn nhp vo t command line
- t thuc tnh mu (s nguyn) nhp t command line
+ To mt command: CRLAY
- Hin th tt c layer c trong bn v.
- Nhp mt vo mt tn
- Set thuc tnh On
- Set n thnh layer hin hnh
- Lp li nu cha chn c layer.
+ To mt command: CERAS
- Chn mt s i tng trn mn hnh
- Hin th Option (kword) hi xa hy khng (Yes/No)
- Nu chn xa th xa ht i tng trong danh sch
+ To mt s commands:
- CTLIN: To ng thng 2 im nhp vo t mn hnh
- CTCIR: To ng trn t mt im v bn knh (getDist)
- CTPOL: To mt polyline t mt s im
- 11 -
- 12 -