-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathAutodesk.AutoCAD.js
7978 lines (7337 loc) · 360 KB
/
Autodesk.AutoCAD.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var Autodesk;
(function (Autodesk) {
//
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2012 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary to Autodesk,
// Inc., and considered a trade secret as defined in section 499C of the
// penal code of the State of California. Use of this information by anyone
// other than authorized employees of Autodesk, Inc. is granted only under a
// written non-disclosure agreement, expressly prescribing the scope and
// manner of such use.
//
///////////////////////////////////////////////////////////////////////////////
// Include TS files
///<reference path="JSGeometry.ts"/>
/**
* For Internal Use
* Create AutoCAD namespace
*
*/
(function (AutoCAD) {
/**
* This enum wraps the Acad::PromptStatus ObjectARX class.
*
*/
(function (PromptStatus) {
PromptStatus[PromptStatus["None"] = 5000] = "None";
PromptStatus[PromptStatus["OK"] = 5100] = "OK";
PromptStatus[PromptStatus["Modeless"] = 5027] = "Modeless";
PromptStatus[PromptStatus["Error"] = -5001] = "Error";
PromptStatus[PromptStatus["Cancel"] = -5002] = "Cancel";
PromptStatus[PromptStatus["Rejected"] = -5003] = "Rejected";
PromptStatus[PromptStatus["Failed"] = -5004] = "Failed";
PromptStatus[PromptStatus["Keyword"] = -5005] = "Keyword";
PromptStatus[PromptStatus["Direct"] = -5999] = "Direct";
})(AutoCAD.PromptStatus || (AutoCAD.PromptStatus = {}));
var PromptStatus = AutoCAD.PromptStatus;
;
/**
* This JSAPI enum wraps resbuf type. This enumeration provides values that
* describe the value data type of a system variable.
*
*/
(function (ResultValueType) {
ResultValueType[ResultValueType["RTNONE"] = 5000] = "RTNONE";
ResultValueType[ResultValueType["RTREAL"] = 5001] = "RTREAL";
ResultValueType[ResultValueType["RTPOINT"] = 5002] = "RTPOINT";
ResultValueType[ResultValueType["RTSHORT"] = 5003] = "RTSHORT";
ResultValueType[ResultValueType["RTANG"] = 5004] = "RTANG";
ResultValueType[ResultValueType["RTSTR"] = 5005] = "RTSTR";
ResultValueType[ResultValueType["RTORINT"] = 5008] = "RTORINT";
ResultValueType[ResultValueType["RT3DPOINT"] = 5009] = "RT3DPOINT";
ResultValueType[ResultValueType["RTLONG"] = 5010] = "RTLONG";
})(AutoCAD.ResultValueType || (AutoCAD.ResultValueType = {}));
var ResultValueType = AutoCAD.ResultValueType;
;
/**
* This enum lists the drag status for jigging.
*
*/
(function (DragStatus) {
DragStatus[DragStatus["kModeless"] = -17] = "kModeless";
DragStatus[DragStatus["kNoChange"] = -6] = "kNoChange";
DragStatus[DragStatus["kCancel"] = -4] = "kCancel";
DragStatus[DragStatus["kOther"] = -3] = "kOther";
DragStatus[DragStatus["kNull"] = -1] = "kNull";
DragStatus[DragStatus["kNormal"] = 0] = "kNormal";
DragStatus[DragStatus["kKW1"] = 1] = "kKW1";
DragStatus[DragStatus["kKW2"] = 2] = "kKW2";
DragStatus[DragStatus["kKW3"] = 3] = "kKW3";
DragStatus[DragStatus["kKW4"] = 4] = "kKW4";
DragStatus[DragStatus["kKW5"] = 5] = "kKW5";
DragStatus[DragStatus["kKW6"] = 6] = "kKW6";
DragStatus[DragStatus["kKW7"] = 7] = "kKW7";
DragStatus[DragStatus["kKW8"] = 8] = "kKW8";
DragStatus[DragStatus["kKW9"] = 9] = "kKW9";
})(AutoCAD.DragStatus || (AutoCAD.DragStatus = {}));
var DragStatus = AutoCAD.DragStatus;
;
/**
* This enum lists the cursor types that may be used while dragging.
*
*/
(function (DragCursor) {
DragCursor[DragCursor["Normal"] = 0] = "Normal";
DragCursor[DragCursor["None"] = 1] = "None";
DragCursor[DragCursor["Selection"] = 2] = "Selection";
})(AutoCAD.DragCursor || (AutoCAD.DragCursor = {}));
var DragCursor = AutoCAD.DragCursor;
;
/**
* This enum wraps the AcEdJig::CursorType ObjectARX enum. It gives the type of cursor that are available.
*
*/
(function (CursorType) {
CursorType[CursorType["kNoSpecialCursor"] = -1] = "kNoSpecialCursor";
CursorType[CursorType["kCrosshair"] = 0] = "kCrosshair";
CursorType[CursorType["kRectCursor"] = 1] = "kRectCursor";
CursorType[CursorType["kRubberBand"] = 2] = "kRubberBand";
CursorType[CursorType["kNotRotated"] = 3] = "kNotRotated";
CursorType[CursorType["kTargetBox"] = 4] = "kTargetBox";
CursorType[CursorType["kRotatedCrosshair"] = 5] = "kRotatedCrosshair";
CursorType[CursorType["kInvisible"] = 7] = "kInvisible";
CursorType[CursorType["kEntitySelect"] = 8] = "kEntitySelect";
CursorType[CursorType["kParallelogram"] = 9] = "kParallelogram";
CursorType[CursorType["kEntitySelectNoPersp"] = 10] = "kEntitySelectNoPersp";
CursorType[CursorType["kPkfirstOrGrips"] = 11] = "kPkfirstOrGrips";
})(AutoCAD.CursorType || (AutoCAD.CursorType = {}));
var CursorType = AutoCAD.CursorType;
;
/**
* This enum lists the transient cursor types that are available. They are the operating system cursors.
*
*/
AutoCAD.TransientCursorType = {
"kNone": "None",
"kArrow": "Arrow",
"kIbeam": "Ibeam",
"kWait": "Wait",
"kCross": "Cross",
"kUpArrow": "UpArrow",
"kSizeNWSE": "SizeNWSE",
"kSizeNESW": "SizeNESW",
"kSizeWE": "SizeWE",
"kSizeNS": "SizeNS",
"kSizeAll": "SizeAll",
"kNo": "No",
"kHand": "Hand",
"kAppStarting": "AppStarting",
"kHelp": "Help"
};
/**
* This enum wraps the AcEdJig::UserInputControls ObjectARX class.
* Returns the bitwise OR'd value of all user input control settings in effect at the present time for this particular jig.
*
*/
(function (UserInputControls) {
UserInputControls[UserInputControls["kGovernedByOrthoMode"] = 0x000001] = "kGovernedByOrthoMode";
UserInputControls[UserInputControls["kNullResponseAccepted"] = 0x000002] = "kNullResponseAccepted";
UserInputControls[UserInputControls["kDontEchoCancelForCtrlC"] = 0x000004] = "kDontEchoCancelForCtrlC";
UserInputControls[UserInputControls["kDontUpdateLastPoint"] = 0x000008] = "kDontUpdateLastPoint";
UserInputControls[UserInputControls["kNoDwgLimitsChecking"] = 0x000010] = "kNoDwgLimitsChecking";
UserInputControls[UserInputControls["kNoZeroResponseAccepted"] = 0x000020] = "kNoZeroResponseAccepted";
UserInputControls[UserInputControls["kNoNegativeResponseAccepted"] = 0x000040] = "kNoNegativeResponseAccepted";
UserInputControls[UserInputControls["kAccept3dCoordinates"] = 0x000080] = "kAccept3dCoordinates";
UserInputControls[UserInputControls["kAcceptMouseUpAsPoint"] = 0x000100] = "kAcceptMouseUpAsPoint";
UserInputControls[UserInputControls["kAnyBlankTerminatesInput"] = 0x000200] = "kAnyBlankTerminatesInput";
UserInputControls[UserInputControls["kInitialBlankTerminatesInput"] = 0x000400] = "kInitialBlankTerminatesInput";
UserInputControls[UserInputControls["kAcceptOtherInputString"] = 0x000800] = "kAcceptOtherInputString";
UserInputControls[UserInputControls["kGovernedByUCSDetect"] = 0x001000] = "kGovernedByUCSDetect";
UserInputControls[UserInputControls["kNoZDirectionOrtho"] = 0x002000] = "kNoZDirectionOrtho";
UserInputControls[UserInputControls["kImpliedFaceForUCSChange"] = 0x004000] = "kImpliedFaceForUCSChange";
UserInputControls[UserInputControls["kUseBasePointElevation"] = 0x008000] = "kUseBasePointElevation";
UserInputControls[UserInputControls["kDisableDirectDistanceInput"] = 0x010000] = "kDisableDirectDistanceInput";
})(AutoCAD.UserInputControls || (AutoCAD.UserInputControls = {}));
var UserInputControls = AutoCAD.UserInputControls;
;
/**
* This enum lists the return result from Task Dialog
*
*/
(function (TaskDialogResult) {
TaskDialogResult[TaskDialogResult["kRetOk"] = 1] = "kRetOk";
TaskDialogResult[TaskDialogResult["kRetCancel"] = 2] = "kRetCancel";
TaskDialogResult[TaskDialogResult["kRetAbort"] = 3] = "kRetAbort";
TaskDialogResult[TaskDialogResult["kRetRetry"] = 4] = "kRetRetry";
TaskDialogResult[TaskDialogResult["kRetIgnore"] = 5] = "kRetIgnore";
TaskDialogResult[TaskDialogResult["kRetYes"] = 6] = "kRetYes";
TaskDialogResult[TaskDialogResult["kRetNo"] = 7] = "kRetNo";
TaskDialogResult[TaskDialogResult["kRetClose"] = 8] = "kRetClose";
TaskDialogResult[TaskDialogResult["kRetHelp"] = 9] = "kRetHelp";
TaskDialogResult[TaskDialogResult["kRetTryAgain"] = 10] = "kRetTryAgain";
TaskDialogResult[TaskDialogResult["kRetContinue"] = 11] = "kRetContinue";
TaskDialogResult[TaskDialogResult["kRetTimeout"] = 32000] = "kRetTimeout";
})(AutoCAD.TaskDialogResult || (AutoCAD.TaskDialogResult = {}));
var TaskDialogResult = AutoCAD.TaskDialogResult;
/**
* This enum lists the button that can be set for Task Dialog
*
*/
(function (TaskDialogButton) {
TaskDialogButton[TaskDialogButton["kButtonOk"] = 0x0001] = "kButtonOk";
TaskDialogButton[TaskDialogButton["kButtonYes"] = 0x0002] = "kButtonYes";
TaskDialogButton[TaskDialogButton["kButtonNo"] = 0x0004] = "kButtonNo";
TaskDialogButton[TaskDialogButton["kButtonCancel"] = 0x0008] = "kButtonCancel";
TaskDialogButton[TaskDialogButton["kButtonRetry"] = 0x0010] = "kButtonRetry";
TaskDialogButton[TaskDialogButton["kButtonClose"] = 0x0020] = "kButtonClose";
})(AutoCAD.TaskDialogButton || (AutoCAD.TaskDialogButton = {}));
var TaskDialogButton = AutoCAD.TaskDialogButton;
/**
* This enum lists the flag associated with AutoCAD command.
*
*/
(function (CommandFlag) {
CommandFlag[CommandFlag["MODAL"] = 0x00000000] = "MODAL";
CommandFlag[CommandFlag["TRANSPARENT"] = 0x00000001] = "TRANSPARENT";
CommandFlag[CommandFlag["USEPICKSET"] = 0x00000002] = "USEPICKSET";
CommandFlag[CommandFlag["REDRAW"] = 0x00000004] = "REDRAW";
CommandFlag[CommandFlag["NOPERSPECTIVE"] = 0x00000008] = "NOPERSPECTIVE";
CommandFlag[CommandFlag["NOMULTIPLE"] = 0x00000010] = "NOMULTIPLE";
CommandFlag[CommandFlag["NOTILEMODE"] = 0x00000020] = "NOTILEMODE";
CommandFlag[CommandFlag["NOPAPERSPACE"] = 0x00000040] = "NOPAPERSPACE";
CommandFlag[CommandFlag["NOOEM"] = 0x00000100] = "NOOEM";
CommandFlag[CommandFlag["UNDEFINED"] = 0x00000200] = "UNDEFINED";
CommandFlag[CommandFlag["INPROGRESS"] = 0x00000400] = "INPROGRESS";
CommandFlag[CommandFlag["DEFUN"] = 0x00000800] = "DEFUN";
CommandFlag[CommandFlag["LISPASCMD"] = 0x00001000] = "LISPASCMD";
CommandFlag[CommandFlag["NONEWSTACK"] = 0x00010000] = "NONEWSTACK";
CommandFlag[CommandFlag["NOINTERNALLOCK"] = 0x00020000] = "NOINTERNALLOCK";
CommandFlag[CommandFlag["DOCREADLOCK"] = 0x00080000] = "DOCREADLOCK";
CommandFlag[CommandFlag["DOCEXCLUSIVELOCK"] = 0x00100000] = "DOCEXCLUSIVELOCK";
CommandFlag[CommandFlag["SESSION"] = 0x00200000] = "SESSION";
CommandFlag[CommandFlag["INTERRUPTIBLE"] = 0x00400000] = "INTERRUPTIBLE";
CommandFlag[CommandFlag["NOHISTORY"] = 0x00800000] = "NOHISTORY";
CommandFlag[CommandFlag["NO_UNDO_MARKER"] = 0x01000000] = "NO_UNDO_MARKER";
CommandFlag[CommandFlag["NOBEDIT"] = 0x02000000] = "NOBEDIT";
CommandFlag[CommandFlag["NOACTIONRECORDING"] = 0x04000000] = "NOACTIONRECORDING";
CommandFlag[CommandFlag["ACTIONMACRO"] = 0x08000000] = "ACTIONMACRO";
CommandFlag[CommandFlag["RELAXASSOC"] = 0x10000000] = "RELAXASSOC";
CommandFlag[CommandFlag["CORE"] = 0x20000000] = "CORE";
CommandFlag[CommandFlag["NOINFERCONSTRAINT"] = 0x40000000] = "NOINFERCONSTRAINT";
CommandFlag[CommandFlag["TEMPSHOWDYNDIM"] = 0x80000000] = "TEMPSHOWDYNDIM";
})(AutoCAD.CommandFlag || (AutoCAD.CommandFlag = {}));
var CommandFlag = AutoCAD.CommandFlag;
;
/**
* For Internal use
*
*/
AutoCAD.Int32MinValue = -(0x8000);
AutoCAD.Int32MaxValue = 0x7FFF;
//TODO: remove in future when Typescript is used for inheritance
/**
* For Internal use
*
*/
AutoCAD.extend = function (subClass, baseClass) {
function inheritance() {
}
inheritance.prototype = baseClass.prototype;
subClass.prototype = new inheritance();
};
/**
* This JSAPI enum wraps the AcGiMapper::Projection ObjectARX enum.
* This enumeration provides values that describe the mapping projection of the mapper.
*
*/
(function (Enum_Projection) {
Enum_Projection[Enum_Projection["Parallel"] = 0] = "Parallel";
Enum_Projection[Enum_Projection["Perspective"] = 1] = "Perspective";
})(AutoCAD.Enum_Projection || (AutoCAD.Enum_Projection = {}));
var Enum_Projection = AutoCAD.Enum_Projection;
;
/**
* This function tests whether the number passed is a valid float
* @param n of type float
* @returns boolean
*/
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n) && typeof (n) !== 'string';
}
AutoCAD.isNumber = isNumber;
;
/**
* This function tests whether the number passed is a Integer
* @param value is a number
* @returns boolean
*/
function isInteger(value) {
return !isNaN(parseInt(value)) && (parseFloat(value) == parseInt(value));
}
AutoCAD.isInteger = isInteger;
/**
* This is ErrorStatus defined for Shaping Layer.
* IMPORTANT: the following enum values have to match the JsErrorStatus defined in %crxapps%\AcJsCoreStub\AcJsCoreStubDefs.h
*/
(function (ErrorStatus) {
ErrorStatus[ErrorStatus["eJsOk"] = 0] = "eJsOk";
ErrorStatus[ErrorStatus["eJsInvalidArguments"] = 1] = "eJsInvalidArguments";
ErrorStatus[ErrorStatus["eJsFail"] = 2] = "eJsFail";
ErrorStatus[ErrorStatus["eJsUnknownError"] = 256] = "eJsUnknownError";
ErrorStatus[ErrorStatus["eJsInvalidInputJsonArgs"] = 257] = "eJsInvalidInputJsonArgs";
ErrorStatus[ErrorStatus["eJsUnSupportedSysVarValueType"] = 258] = "eJsUnSupportedSysVarValueType";
ErrorStatus[ErrorStatus["eJsUnknownCallback"] = 259] = "eJsUnknownCallback";
ErrorStatus[ErrorStatus["eJsInvalidTooltipId"] = 260] = "eJsInvalidTooltipId";
ErrorStatus[ErrorStatus["eJsUnknownFunctionName"] = 261] = "eJsUnknownFunctionName";
ErrorStatus[ErrorStatus["eJsUnknownCompleteCallback"] = 262] = "eJsUnknownCompleteCallback";
ErrorStatus[ErrorStatus["eJsUnknownErrorCallback"] = 263] = "eJsUnknownErrorCallback";
ErrorStatus[ErrorStatus["eJsNoDocument"] = 264] = "eJsNoDocument";
ErrorStatus[ErrorStatus["eJsSyncFunction"] = 265] = "eJsSyncFunction";
ErrorStatus[ErrorStatus["eJsAsyncFunction"] = 266] = "eJsAsyncFunction";
ErrorStatus[ErrorStatus["eJsFailGetCurGsView"] = 267] = "eJsFailGetCurGsView";
ErrorStatus[ErrorStatus["eJsFailGetSysVar"] = 268] = "eJsFailGetSysVar";
ErrorStatus[ErrorStatus["eJsFailGetDrawable"] = 269] = "eJsFailGetDrawable";
ErrorStatus[ErrorStatus["eJsInvalidTransientId"] = 270] = "eJsInvalidTransientId";
ErrorStatus[ErrorStatus["eJsFailCreateJig"] = 271] = "eJsFailCreateJig";
ErrorStatus[ErrorStatus["eJsJigPromptSet"] = 272] = "eJsJigPromptSet";
ErrorStatus[ErrorStatus["eJsNotSupportedInPaperSpace"] = 273] = "eJsNotSupportedInPaperSpace";
ErrorStatus[ErrorStatus["eJsCommandLineBusy"] = 274] = "eJsCommandLineBusy";
ErrorStatus[ErrorStatus["eJsNotAvailableInLockedViewport"] = 275] = "eJsNotAvailableInLockedViewport";
ErrorStatus[ErrorStatus["eJsCancel"] = 276] = "eJsCancel";
})(AutoCAD.ErrorStatus || (AutoCAD.ErrorStatus = {}));
var ErrorStatus = AutoCAD.ErrorStatus;
;
/*
* Creates a container object which holds Viewport related properties
* @param position of type Acad.Position3d
* @param target of type Acad.Position3d
* @param upVector of type Acad.Vector3d
* @param fieldWidth of type double
* @param fieldHeight of type double
* @param projection of type Acad.Enum_Projection
* @return a container object of type Acad.ViewProperties
*
*/
var ViewProperties = (function () {
function ViewProperties(position, target, upVector, fieldWidth, fieldHeight, projection) {
if (!isNumber(fieldWidth)) {
throw TypeError('fieldWidth should be a double value');
}
if (!isNumber(fieldHeight)) {
throw TypeError('fieldHeight should be a double value');
}
if (!(position instanceof Acad.Point3d)) {
throw TypeError('position should be of type Acad.Point3d');
}
if (!(target instanceof Acad.Point3d)) {
throw TypeError('target should be of type Acad.Point3d');
}
if (!(upVector instanceof Acad.Vector3d)) {
throw TypeError('upVector should be of type Acad.Vector3d');
}
if (!(projection === Acad.Enum_Projection.Parallel || projection === Acad.Enum_Projection.Perspective)) {
throw TypeError('projection should be Acad.Enum_Projection.Parallel or Acad.Enum_Projection.Perspective ');
}
this.position = position;
this.target = target;
this.upVector = upVector;
this.fieldWidth = fieldWidth;
this.fieldHeight = fieldHeight;
this.projection = projection;
}
return ViewProperties;
})();
AutoCAD.ViewProperties = ViewProperties;
;
/*
* This is also used as a base class, designed to achieve Promise Pattern
*
*/
var Promise = (function () {
function Promise() {
}
/*
* This is the function used to register callback
* @param success Function pointer call at the time of success/cancel.
* @param error Function pointer call at the time of error.
* @throws TypeError
*
*/
Promise.prototype.then = function (success, error) {
if (typeof (success) == 'function')
this.success = success;
else
throw TypeError('success function pointer should be of type function');
if (typeof (error) == 'function')
this.error = error;
else
throw TypeError('error function pointer should be of type function');
};
return Promise;
})();
AutoCAD.Promise = Promise;
})(Autodesk.AutoCAD || (Autodesk.AutoCAD = {}));
var AutoCAD = Autodesk.AutoCAD;
})(Autodesk || (Autodesk = {}));
var Acad = Autodesk.AutoCAD;
var Autodesk;
(function (Autodesk) {
//
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2012 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary to Autodesk,
// Inc., and considered a trade secret as defined in section 499C of the
// penal code of the State of California. Use of this information by anyone
// other than authorized employees of Autodesk, Inc. is granted only under a
// written non-disclosure agreement, expressly prescribing the scope and
// manner of such use.
//
///////////////////////////////////////////////////////////////////////////////
// Include TS files
///<reference path="Acad.ts"/>
/**
* This class wraps AcGePoint2d ObjectARX class. It represents a point in 2-dimensional space. It can be viewed as a structure consisting of two doubles.
* @param coordinates x, y.
* @throws TypeError
*
*/
(function (AutoCAD) {
var Point2d = (function () {
function Point2d(x, y) {
if (typeof x == 'number')
this.x = x;
else
throw TypeError("x is not number");
if (typeof y == 'number')
this.y = y;
else
throw TypeError("y is not number");
}
return Point2d;
})();
AutoCAD.Point2d = Point2d;
/**
* This class wraps AcGePoint3d ObjectARX class. It represents a point in 3D space. It can be viewed as a structure consisting of three doubles.
* @param coordinates x, y, and z.
* @throws TypeError
*
*/
var Point3d = (function () {
function Point3d(x, y, z) {
if (typeof x == 'number')
this.x = x;
else
throw TypeError("x is not number");
if (typeof y == 'number')
this.y = y;
else
throw TypeError("y is not number");
if (typeof z == 'number')
this.z = z;
else
throw TypeError("z is not number");
}
return Point3d;
})();
AutoCAD.Point3d = Point3d;
/**
* This class wraps the AcGeVector2d ObjectARX class.
* Vector2d represents a vector in 2D space. It can be viewed as a structure consisting of two doubles.
* @param coordinates x, y.
* @throws TypeError
*
*/
var Vector2d = (function () {
function Vector2d(x, y) {
if (typeof x == 'number')
this.x = x;
else
throw TypeError("x is not number");
if (typeof y == 'number')
this.y = y;
else
throw TypeError("y is not number");
}
return Vector2d;
})();
AutoCAD.Vector2d = Vector2d;
/**
* This class wraps the AcGeVector3d ObjectARX class.
* Vector3d represents a vector in 3D space. It can be viewed as a structure consisting of 3 doubles.
* @param coordinates x, y, and z correspondingly.
* @throws TypeError
*
*/
var Vector3d = (function () {
function Vector3d(x, y, z) {
if (typeof x == 'number')
this.x = x;
else
throw TypeError("x is not number");
if (typeof y == 'number')
this.y = y;
else
throw TypeError("y is not number");
if (typeof z == 'number')
this.z = z;
else
throw TypeError("z is not number");
}
return Vector3d;
})();
AutoCAD.Vector3d = Vector3d;
/**
* This class wraps the lowerLeft and upperRight Point2d objects.
* @param lowerLeft point of type Acad.Point2d
* @param upperRight point of type Acad.Point2d
* @throws TypeError
*
*/
var Rectangle2d = (function () {
function Rectangle2d(lowerLeft, upperRight) {
if (lowerLeft instanceof Acad.Point2d)
this.lowerLeft = lowerLeft;
else
throw TypeError("lowerLeft should be of Acad.Point2d type.");
if (upperRight instanceof Acad.Point2d)
this.upperRight = upperRight;
else
throw TypeError("upperRight should be of Acad.Point2d type.");
}
return Rectangle2d;
})();
AutoCAD.Rectangle2d = Rectangle2d;
/**
* @class Acad.Bounds3d,
* The object represents the 3d geometric extents of an entity
* Its similar to AcDbExtents, with minimum and maximum points
* @param minPt3d is the minimum point of the extents
* @param maxPt3d is the maximum point of the extents
* @throws TypeError
*
*/
var Bounds3d = (function () {
function Bounds3d(minPt3d, maxPt3d) {
if (minPt3d instanceof Acad.Point3d)
this.minPoint3d = minPt3d;
else
throw TypeError("minPt3d should be of Acad.Point3d type.");
if (maxPt3d instanceof Acad.Point3d)
this.maxPoint3d = maxPt3d;
else
throw TypeError("maxPt3d should be of Acad.Point3d type.");
}
return Bounds3d;
})();
AutoCAD.Bounds3d = Bounds3d;
//TODO: check compatibility with previous js
/**
* This class wraps the AcGeMatrix3d ObjectARX class.
* Class Matrix3d represents an affine transformation of 3D space, including translation.
*
*/
var Matrix3d = (function () {
function Matrix3d() {
var matrix = new Array(4);
for (var i = 0; i < matrix.length; i++)
matrix[i] = new Array(4);
return matrix;
}
return Matrix3d;
})();
AutoCAD.Matrix3d = Matrix3d;
})(Autodesk.AutoCAD || (Autodesk.AutoCAD = {}));
var AutoCAD = Autodesk.AutoCAD;
})(Autodesk || (Autodesk = {}));
var Autodesk;
(function (Autodesk) {
//
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2012 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary to Autodesk,
// Inc., and considered a trade secret as defined in section 499C of the
// penal code of the State of California. Use of this information by anyone
// other than authorized employees of Autodesk, Inc. is granted only under a
// written non-disclosure agreement, expressly prescribing the scope and
// manner of such use.
//
///////////////////////////////////////////////////////////////////////////////
// Include TS files
///<reference path="Acad.ts"/>
///<reference path="Application.ts"/>
(function (AutoCAD) {
/**
* @class Acad.TransientManager
* This is the controller object that is used to create and manage the
* transients.
*/
var TransientManager = (function () {
function TransientManager() {
this.transients = [];
this.transientid = 1;
this.IsRegisteredForEvents = false;
}
/**
* This function is for internal use.
*
*/
TransientManager.prototype.transientManager_event = function (eventArgs) {
if (!eventArgs) {
return;
}
var id = eventArgs.id;
var index = this.getIndex(id);
if (index == -1) {
return;
}
var transient = this.transients[index];
eventArgs.transient = transient;
transient.dispatchEvent(eventArgs.eventname, eventArgs);
};
/**
* The addTransient function is used to add an Acad.Transient object to the AutoCAD transient manager.
* The XML data represents an AcGiDrawable object defined by the transient.xsd schema.
* @param transient is of type Acad.Transient.
* @param xmlData is of type string.
* @param onComplete is a function type called on successful completion of this method.
* @param onError is a function type called if an error occurs.
*
*/
TransientManager.prototype.addTransient = function (transient, xmlData) {
if (!this.IsRegisteredForEvents) {
var obj = this;
AutoCAD.TransientManagerInterop.addHandler_mouseChanged(function (eventArgs) {
obj.transientManager_event(eventArgs);
});
this.IsRegisteredForEvents = true;
}
if (this.getIndex(transient.getId()) != -1) {
return;
}
this.transients.push(transient);
return AutoCAD.TransientManagerInterop.addTransient(transient.getId(), xmlData);
};
/**
* The updateTransient function is used to update an Acad.Transient object in the AutoCAD transient manager.
* The XML data represents an AcGiDrawable object defined by the transient.xsd schema.
* @param transientId is of type int.
* @param xmlData is of type string.
* @param onComplete is a function type called on successful completion of this method.
* @param onError is a function type called if an error occurs.
*
*/
TransientManager.prototype.updateTransient = function (transientId, xmlData) {
return AutoCAD.TransientManagerInterop.updateTransient(transientId, xmlData);
};
/**
* The eraseTransient function is used erase the the Acad.Transient object from the AutoCAD transient manager.
* @param transientId is of type int.
* @param onComplete is a function type called on successful completion of this method.
* @param onError is a function type called if an error occurs.
*
*/
TransientManager.prototype.eraseTransient = function (transientId) {
return AutoCAD.TransientManagerInterop.eraseTransient(transientId);
};
/**
* The eraseTransients function is used erase Acad.Transient objects from the AutoCAD transient manager.
* @param transientIds is of type Array int.
* @param onComplete is a function type called on successful completion of this method.
* @param onError is a function type called if an error occurs.
*
*/
TransientManager.prototype.eraseTransients = function (transientIds) {
return AutoCAD.TransientManagerInterop.eraseTransients(transientIds);
};
/**
* The showTransients function is used show or hide the Acad.Transient objects in
* the AutoCAD transient manager.
* @param transientIds is of type Array int.
* @param bShow is of type bool.
* @param onComplete is a function type called on successful completion of this method.
* @param onError is a function type called if an error occurs.
*
*/
TransientManager.prototype.showTransients = function (transientIds, bShow) {
return AutoCAD.TransientManagerInterop.showTransients(transientIds, bShow);
};
/**
* The getCursor function is used to get the current cursor assigned to the Acad.Transient object.
* It is returned in the cursor property of the object in the onComplete method.
* This is the optional 'cursor' attribute in the transient XML schema.
* @param transientId is of type int.
* @param onComplete is a function type called on successful completion of this method.
* @param onError is a function type called if an error occurs.
*
*/
TransientManager.prototype.getCursor = function (transientId) {
return AutoCAD.TransientManagerInterop.getCursor(transientId);
};
/**
* This function is a private API for internal use.
*
*/
TransientManager.prototype.generateImage = function (imgtype, imgId, imgPostedBy, imgMessage) {
var jsonStr = exec(JSON.stringify({ functionName: 'Ac_Transientmanager_generateimage', invokeAsCommand: false, functionParams: { type: imgtype, id: imgId, postedby: imgPostedBy, message: imgMessage } }));
return jsonStr;
};
/**
* This function is for internal use.
* generate id from stub layer
*
*/
TransientManager.prototype.getNewId = function () {
return AutoCAD.TransientManagerInterop.getNewTransientId();
};
/**
* This function is for internal use.
*
*/
TransientManager.prototype.getIndex = function (id) {
for (var i = 0, len = this.transients.length; i < len; i++) {
if (this.transients[i].getId() === id) {
return i;
}
}
return -1;
};
/**
* This function is for internal use.
*
*/
TransientManager.prototype.setEventHandlingBehavior = function (id, eventname, bFilter) {
AutoCAD.TransientManagerInterop.setEventHandlingBehavior(id, eventname, bFilter);
};
TransientManager.prototype.complete = function () {
};
TransientManager.prototype.error = function () {
};
return TransientManager;
})();
AutoCAD.TransientManager = TransientManager;
/**
* @class Acad.TransientManager
* This is the controller object that is used to create and manage the
* transients.
*/
var Transient = (function () {
function Transient() {
this.eventname = {
mousemove: "mousemove",
mouseleave: "mouseleave",
lbuttondown: "lbuttondown",
lbuttonup: "lbuttonup",
lbuttondblclk: "lbuttondblclk",
rbuttondown: "rbuttondown",
rbuttonup: "rbuttonup",
rbuttondblclk: "rbuttondblclk",
mbuttondown: "mbuttondown",
mbuttonup: "mbuttonup",
mbuttondblclk: "mbuttondblclk",
mousewheel: "mousewheel"
};
this.id = Acad.Application.activedocument.transientManager.getNewId();
this.eventobject = new Acad.EventObject();
}
/**
* This function is used to add a callback.
* @param eventname is the event for which fn would be called.
* @param fn is a callback function, which is called when an event occurs.
*
*/
Transient.prototype.addEventListener = function (eventname, fn) {
this.eventobject.addEventListener(eventname, fn);
};
/**
* This function is used to remove a callback.
* @param eventname is the event for which fn would be called.
* @param fn is a callback function, which would not be called further for the given eventname.
*
*/
Transient.prototype.removeEventListener = function (eventname, fn) {
this.eventobject.removeEventListener(eventname, fn);
};
/**
* The getId function is used get the assigned transient id.
* @return int.
*
*/
Transient.prototype.getId = function () {
return this.id;
};
/**
* This function is for internal use.
*
*/
Transient.prototype.dispatchEvent = function (eventname, args) {
this.eventobject.dispatchEvent(eventname, args);
};
Transient.prototype.setEventHandlingBehavior = function (eventname, bFilter) {
Acad.Application.activedocument.transientManager.setEventHandlingBehavior(this.id, eventname, bFilter);
};
return Transient;
})();
AutoCAD.Transient = Transient;
})(Autodesk.AutoCAD || (Autodesk.AutoCAD = {}));
var AutoCAD = Autodesk.AutoCAD;
})(Autodesk || (Autodesk = {}));
var Autodesk;
(function (Autodesk) {
//
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright 2012 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary to Autodesk,
// Inc., and considered a trade secret as defined in section 499C of the
// penal code of the State of California. Use of this information by anyone
// other than authorized employees of Autodesk, Inc. is granted only under a
// written non-disclosure agreement, expressly prescribing the scope and
// manner of such use.
//
///////////////////////////////////////////////////////////////////////////////
// Include TS files
///<reference path="Acad.ts"/>
///<reference path="Transient.ts"/>
(function (AutoCAD) {
/**
* @class Acad.OSet,
* The object contains a collection of object identifiers.
* Its similar to ads_name, and valid only while you are working on a drawing
* with AutoCAD, and they are invalid when exiting from AutoCAD or switching to
* another drawing.
*/
var OSet = (function () {
function OSet() {
this.dbObjects = [];
}
OSet.prototype.getIndex = function (id) {
for (var i = 0, len = this.dbObjects.length; i < len; i++) {
if (this.dbObjects[i] == id) {
return i;
}
}
return -1;
};
/**
* The method will add the input object id to the collection.
* @param Input object id.
*/
OSet.prototype.add = function (id) {
if (!id) {
return;
}
if (typeof id === "string" || typeof id === "number") {
this.dbObjects.push(id);
} else if (id instanceof Array) {
this.dbObjects = this.dbObjects.concat(id);
} else if (id instanceof OSet) {
for (var i = 0, len = id.getCount(); i < len; i++) {
this.dbObjects.push(id.getId(i));
}
}
};
/**
* The method will remove the input object id from the collection.
* @param Input id.
*/
OSet.prototype.remove = function (id) {
var index = this.getIndex(id);
if (index !== -1) {
this.dbObjects.splice(index, 1);
}
};
/**
* The method will remove all the ids from the collection.
*/
OSet.prototype.clear = function () {
this.dbObjects = [];
};
/**
* The method will return the number of items in the collection.
* @return Returns the number of items in the collection.
*/
OSet.prototype.getCount = function () {
return this.dbObjects.length;
};
/**
* The method will return the id given the index of the item in the collection.
* @param Input index, it should be more than or equal to 0 and less than the number of items in the collection.
* @return Returns the id at the given index.
*/
OSet.prototype.getId = function (index) {
return this.dbObjects[index];
};
/**
* The method will return the index of the input id, in the collection.
* @param Input id.
* @return Returns the index of the input id if it is present, otherwise returns -1.
*/
OSet.prototype.indexOf = function (id) {
return this.getIndex(id);
};
/**
* The method can be used to test if the id is present in the collection.
* @param Input id.
* @return Returns true if the id is present in the collection, otherwise returns false.
*/
OSet.prototype.contains = function (id) {
return this.getIndex(id) != -1;
};
/**
* The method will return all the ids in the collection.
* @return Returns an array that contains all the ids in the collection.
*/
OSet.prototype.getAllIds = function () {
var ids = [];
ids = ids.concat(this.dbObjects);
return ids;
};
return OSet;
})();
AutoCAD.OSet = OSet;
/**
* @class Acad.DBEntity,
* The object represents a database resident entity
* Its similar to AcDbEntity, and valid only while you are working on a drawing
* with AutoCAD, and is invalid when exiting from AutoCAD or switching to
* another drawing.
* @param id is the object identifier
*/
var DBEntity = (function () {
function DBEntity(id) {
if (!id) {
throw TypeError(" id is mandatory for new DBEntity");
}
this.entityId = id;
}
Object.defineProperty(DBEntity.prototype, "id", {
get: /**
* Returns the object identifier. Read only property.
* @return id which is of string type
*/
function () {
return this.entityId;
},
set: function (val) {
throw Error(" You are not allowed to set this property");
},
enumerable: true,
configurable: true
});
/**
* Returns the object geometric extents defined by min and max points.
* @return object of type Acad.Bounds3d
*/