개정판 c6df982b
dev issue #1230 : edit line CoordinateCorrection and label place
Change-Id: Ifa892df095816057fe1241d96ed1b4b7336fcf76
DTI_PID/APIDConverter/AutoModeling.cs | ||
---|---|---|
120 | 120 |
RunSymbolModeling(); |
121 | 121 |
RunTextModeling(); |
122 | 122 |
RunNoteModeling(); |
123 |
|
|
124 |
Zoom(0, 0, 10, 10); |
|
123 | 125 |
RunInputLineAttribute(); |
124 | 126 |
RunInputLineNumberAttribute(); |
125 | 127 |
RunInputSymbolAttribute(); |
128 |
ZoomAll(); |
|
126 | 129 |
} |
127 | 130 |
catch (System.Exception ex) |
128 | 131 |
{ |
... | ... | |
294 | 297 |
{ |
295 | 298 |
ObjectId objectId = APIDUtils.GetObjectIdByHandle(handle); |
296 | 299 |
if (objectId != ObjectId.Null) |
297 |
{ |
|
298 | 300 |
SetBlockReferenceRotation(objectId, symbol.ANGLE); |
299 |
} |
|
300 | 301 |
} |
301 | 302 |
} |
302 | 303 |
} |
... | ... | |
379 | 380 |
} |
380 | 381 |
if (datas.Count > 0) |
381 | 382 |
{ |
383 |
double x = Math.Round((line.Aveva.Start_X + line.Aveva.End_X) / 2), y = Math.Round((line.Aveva.Start_Y + line.Aveva.End_Y) / 2); |
|
382 | 384 |
ObjectId objectId = GetFirstPolyLineObjectId(line.Aveva.Handle); |
383 | 385 |
if (!objectId.IsNull) |
384 |
SetAttributeByAvevaForm(objectId.Handle.Value, datas); |
|
386 |
SetAttributeByAvevaForm(objectId.Handle.Value, datas, x, y);
|
|
385 | 387 |
} |
386 | 388 |
} |
387 | 389 |
} |
... | ... | |
398 | 400 |
} |
399 | 401 |
if (datas.Count > 0) |
400 | 402 |
{ |
403 |
double x = symbol.Aveva.X, y = symbol.Aveva.Y; |
|
401 | 404 |
ObjectId objectId = APIDUtils.GetObjectIdByHandle(symbol.Aveva.Handle); |
402 | 405 |
if (!objectId.IsNull) |
403 |
SetAttributeByAvevaForm(objectId.Handle.Value, datas); |
|
406 |
SetAttributeByAvevaForm(objectId.Handle.Value, datas, x, y);
|
|
404 | 407 |
} |
405 | 408 |
} |
406 | 409 |
} |
410 |
private void ConvertBranchPipe(Model.Line branchLine, Model.Line mainLine) |
|
411 |
{ |
|
412 |
|
|
413 |
} |
|
407 | 414 |
#endregion |
408 | 415 |
|
409 | 416 |
#region Drawing Method |
... | ... | |
521 | 528 |
double x = symbol.Aveva.X; |
522 | 529 |
double y = symbol.Aveva.Y; |
523 | 530 |
|
531 |
if (symbol.GetType() != typeof(OPC)) |
|
532 |
Zoom(x - 50, y - 50, x + 50, y + 50); |
|
533 |
|
|
524 | 534 |
List<long> prevHandles = GetAllBlockHandlesByName(insertSymbolName); |
525 | 535 |
|
526 | 536 |
AVEVA.PID.Utilities.DrawingData drawingData = new AVEVA.PID.Utilities.DrawingData(); |
... | ... | |
709 | 719 |
#endregion |
710 | 720 |
|
711 | 721 |
#region For Aveva |
712 |
private void SetAttributeByAvevaForm(long handle, List<Tuple<string, string>> datas) |
|
722 |
double labelX, labelY; |
|
723 |
private void SetAttributeByAvevaForm(long handle, List<Tuple<string, string>> datas, double x, double y) |
|
713 | 724 |
{ |
714 |
Entity entity = APIDUtils.GetEntityByHandle(handle); |
|
725 |
labelX = x; |
|
726 |
labelY = y; |
|
727 |
AddPromptingForPointForAvevaPropertiesForm(); |
|
728 |
try |
|
729 |
{ |
|
730 |
Entity entity = APIDUtils.GetEntityByHandle(handle); |
|
731 |
ComponentPropertiesHelper componentPropertiesHelper = new ComponentPropertiesHelper(); |
|
732 |
AvevaThread.Run(ThreadType.AddProperty, datas); |
|
733 |
componentPropertiesHelper.DisplayComponentProperties(entity); |
|
734 |
AvevaThread.Stop(ThreadType.AddProperty); |
|
735 |
} |
|
736 |
catch (System.Exception ex) |
|
737 |
{ |
|
715 | 738 |
|
716 |
ComponentPropertiesHelper componentPropertiesHelper = new ComponentPropertiesHelper(); |
|
717 |
AvevaThread.Run(ThreadType.AddProperty, datas); |
|
718 |
componentPropertiesHelper.DisplayComponentProperties(entity); |
|
719 |
AvevaThread.Stop(ThreadType.AddProperty); |
|
739 |
} |
|
740 |
finally |
|
741 |
{ |
|
742 |
RemovePromptingForPointForAvevaPropertiesForm(); |
|
743 |
} |
|
744 |
} |
|
745 |
private void AddPromptingForPointForAvevaPropertiesForm() |
|
746 |
{ |
|
747 |
Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; |
|
748 |
Editor editor = acDoc.Editor; |
|
749 |
editor.PromptingForPoint += Editor_PromptingForPointForAvevaPropertiesForm; |
|
750 |
editor.PromptingForAngle += Editor_PromptingForAngleForAvevaPropertiesForm; |
|
751 |
} |
|
752 |
private void RemovePromptingForPointForAvevaPropertiesForm() |
|
753 |
{ |
|
754 |
Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; |
|
755 |
Editor editor = acDoc.Editor; |
|
756 |
editor.PromptingForPoint -= Editor_PromptingForPointForAvevaPropertiesForm; |
|
757 |
editor.PromptingForAngle -= Editor_PromptingForAngleForAvevaPropertiesForm; |
|
758 |
} |
|
759 |
private void Editor_PromptingForPointForAvevaPropertiesForm(object sender, PromptPointOptionsEventArgs e) |
|
760 |
{ |
|
761 |
Autodesk.AutoCAD.Interop.AcadApplication acadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication as Autodesk.AutoCAD.Interop.AcadApplication; |
|
762 |
acadApplication.ActiveDocument.SendCommand(string.Format(" {0},{1} ", labelX, labelY)); |
|
763 |
} |
|
764 |
private void Editor_PromptingForAngleForAvevaPropertiesForm(object sender, PromptAngleOptionsEventArgs e) |
|
765 |
{ |
|
766 |
Autodesk.AutoCAD.Interop.AcadApplication acadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication as Autodesk.AutoCAD.Interop.AcadApplication; |
|
767 |
acadApplication.ActiveDocument.SendCommand(" 0 "); |
|
720 | 768 |
} |
721 | 769 |
#endregion |
722 | 770 |
|
... | ... | |
786 | 834 |
else if (line.SlopeType == SlopeType.VERTICAL && |
787 | 835 |
prevLine.SlopeType == SlopeType.HORIZONTAL) |
788 | 836 |
points.Add(line.Aveva.Start_X + "," + prevLine.Aveva.End_Y); |
789 |
else |
|
837 |
else if (line.SlopeType == SlopeType.Slope || |
|
838 |
prevLine.SlopeType == SlopeType.Slope) |
|
790 | 839 |
points.Add(line.Aveva.Start_X + "," + line.Aveva.Start_Y); |
791 | 840 |
} |
792 | 841 |
|
DTI_PID/APIDConverter/Model/PlantItem/Document.cs | ||
---|---|---|
686 | 686 |
|
687 | 687 |
ConvertAvevaPoint(ref x, ref y); |
688 | 688 |
|
689 |
item.Aveva.X = x;
|
|
690 |
item.Aveva.Y = y;
|
|
689 |
item.Aveva.X = Math.Round(x);
|
|
690 |
item.Aveva.Y = Math.Round(y);
|
|
691 | 691 |
|
692 | 692 |
item.Aveva.FullName = (string)rows[0]["APID_SYMBOL"]; |
693 | 693 |
string[] split = item.Aveva.FullName.Split(new char[] { '\\' }); |
... | ... | |
707 | 707 |
|
708 | 708 |
ConvertAvevaPoint(ref x, ref y); |
709 | 709 |
|
710 |
item.Aveva.X = x;
|
|
711 |
item.Aveva.Y = y;
|
|
710 |
item.Aveva.X = Math.Round(x);
|
|
711 |
item.Aveva.Y = Math.Round(y);
|
|
712 | 712 |
|
713 | 713 |
if (item.TYPE == "Piping OPC's") |
714 | 714 |
item.OPCType = OPCType.Pipe; |
... | ... | |
751 | 751 |
|
752 | 752 |
ConvertAvevaPoint(ref x, ref y); |
753 | 753 |
|
754 |
item.Aveva.X = x;
|
|
755 |
item.Aveva.Y = y;
|
|
754 |
item.Aveva.X = Math.Round(x);
|
|
755 |
item.Aveva.Y = Math.Round(y);
|
|
756 | 756 |
item.Aveva.LabelType = LabelType.LineNumber; |
757 | 757 |
item.Aveva.Angle = RadianToDegree(item.ANGLE); |
758 | 758 |
} |
... | ... | |
764 | 764 |
double x = item.X1; |
765 | 765 |
double y = SIZE_HEIGHT - item.Y2; |
766 | 766 |
ConvertAvevaPoint(ref x, ref y); |
767 |
item.Aveva.X = x;
|
|
768 |
item.Aveva.Y = y;
|
|
767 |
item.Aveva.X = Math.Round(x);
|
|
768 |
item.Aveva.Y = Math.Round(y);
|
|
769 | 769 |
|
770 | 770 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
771 | 771 |
{ |
... | ... | |
798 | 798 |
double x = item.X1; |
799 | 799 |
double y = SIZE_HEIGHT - item.Y2; |
800 | 800 |
ConvertAvevaPoint(ref x, ref y); |
801 |
item.Aveva.X = x;
|
|
802 |
item.Aveva.Y = y;
|
|
801 |
item.Aveva.X = Math.Round(x);
|
|
802 |
item.Aveva.Y = Math.Round(y);
|
|
803 | 803 |
|
804 | 804 |
if (item.TextAngle == TextAngle.Degree0 || item.TextAngle == TextAngle.Degree180) |
805 | 805 |
{ |
DTI_PID/APIDConverter/PIDCustomization.cs | ||
---|---|---|
414 | 414 |
//Thread tt = new Thread(AvevaThread.Test); |
415 | 415 |
//tt.IsBackground = true; |
416 | 416 |
//tt.Start(); |
417 |
|
|
417 |
|
|
418 | 418 |
Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; |
419 | 419 |
Editor editor = acDoc.Editor; |
420 | 420 |
editor.PromptingForPoint += Editor_PromptingForPoint; |
... | ... | |
428 | 428 |
|
429 | 429 |
Autodesk.AutoCAD.Interop.AcadApplication acadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication as Autodesk.AutoCAD.Interop.AcadApplication; |
430 | 430 |
AcadUtility acutil = (AcadUtility)acadApplication.ActiveDocument.Utility as AcadUtility; |
431 |
|
|
431 |
string aa = AVEVA.PID.Components.DesignatorAIValue.strHandle; |
|
432 |
int dd = acadApplication.ActiveDocument.SelectionSets.Count; |
|
433 |
|
|
434 |
|
|
435 |
//acadApplication.ActiveDocument.SendCommand(" 100,100 "); |
|
432 | 436 |
} |
433 | 437 |
|
434 | 438 |
[CommandMethod("PicTest", Autodesk.AutoCAD.Runtime.CommandFlags.UsePickSet)] |
... | ... | |
451 | 455 |
|
452 | 456 |
if (selectedObjectIds.Length > 0) |
453 | 457 |
{ |
454 |
ObjectId objIdBlock = selectedObjectIds[0]; |
|
455 |
AutoModeling.TESTStatic(objIdBlock.Handle.Value); |
|
458 |
ObjectId objectId = selectedObjectIds[0]; |
|
459 |
using (Transaction tr = acCurDb.TransactionManager.StartTransaction()) |
|
460 |
{ |
|
461 |
DBObject dBObject = tr.GetObject(objectId, OpenMode.ForWrite); |
|
462 |
if (dBObject.GetType() == typeof(Polyline)) |
|
463 |
{ |
|
464 |
Polyline line = dBObject as Polyline; |
|
465 |
line.SetPointAt(line.NumberOfVertices - 1, new Point2d(line.EndPoint.X + 3, line.EndPoint.Y + 3)); |
|
466 |
} |
|
467 |
|
|
468 |
//if (objectId.ObjectClass.DxfName == "TEXT") |
|
469 |
//{ |
|
470 |
// DBText text = (DBText)tr.GetObject(objectId, OpenMode.ForWrite); |
|
471 |
// text.TextString += " DIS"; |
|
472 |
//} |
|
473 |
//else |
|
474 |
//{ |
|
475 |
// MText mtext = (MText)tr.GetObject(objectId, OpenMode.ForWrite); |
|
476 |
// mtext.Contents += " DIS"; |
|
477 |
//} |
|
478 |
tr.Commit(); |
|
479 |
} |
|
456 | 480 |
} |
457 | 481 |
} |
458 | 482 |
} |
DTI_PID/APIDConverter/Utils/AvevaACAD18String.cs | ||
---|---|---|
20 | 20 |
static List<string> labelNames = new List<string>() |
21 | 21 |
{ |
22 | 22 |
"AddLabel", |
23 |
"AddPrefix", |
|
24 |
"AddType", |
|
25 |
"AddNumber", |
|
26 |
"AddSuffix", |
|
23 |
//"AddPrefix",
|
|
24 |
//"AddType",
|
|
25 |
//"AddNumber",
|
|
26 |
//"AddSuffix",
|
|
27 | 27 |
}; |
28 | 28 |
public static List<string> LabelNames { get { return labelNames; } } |
29 | 29 |
public static List<string> PropertiesFormNames { get { return propertiesFormNames; } } |
내보내기 Unified diff