DiscussionsIssue archiveOCCT:Data Exchange

Archived issue #0027142

Data Exchange - add possibility to set location in XCAFDoc_ShapeTool interface

Open CASCADEOCCT:Data Exchangeclosed8 public notes

Search issues

Description

It is supposed to add possibility to change XCAFDoc_Location attribute with XCAFDoc_ShapeTool.

Steps to reproduce

It's improvement

Public activity

8 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Feb 8 14:47:57 2016 +0300

    0027142: Data Exchange - add possibility to set location in XCAFDoc_ShapeTool interface
02Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
03Commenter 2
src / XCAFDoc / XCAFDoc_ShapeTool.hxx
//! Sets new location to the shape

This may lead to some misunderstanding, the following lines will suffice.
 src / XCAFDoc / XCAFDoc_ShapeTool.cxx
+  Standard_EXPORT Standard_Boolean SetLocation (const TDF_Label& theShapeLabel, const TopLoc_Location& theLoc, TDF_Label& theRefLabel);
 src / XCAFDoc / XCAFDoc_ShapeTool.cxx
+Standard_Boolean XCAFDoc_ShapeTool::SetLocation (const TDF_Label& theShapeLabel, const TopLoc_Location& theLoc, TDF_Label& theRefLabel)

Separate the parameters on each line.
+//=======================================================================
+// function : SetLocation
+// purpose  :
+//=======================================================================
+
+Standard_Boolean XCAFDoc_ShapeTool::SetLocation (const TDF_Label& theShapeLabel, const TopLoc_Location& theLoc, TDF_Label& theRefLabel)

Remove new line between description and method
src / XCAFDoc / XCAFDoc_ShapeTool.cxx
+  // if input label is reference -> just change the location attribute
+  // if input label is shape, and it is free -> create reference to the shape

What if I want to move assembly?
src / XDEDRAW / XDEDRAW_Shapes.cxx
+static Standard_Boolean parseXYZ (const char** theArgVec, gp_XYZ& thePnt)
+
+static Standard_Integer setLocation (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)

No method description(header) {function... purpose...}
+
+  di.Add ("XSetLocation", R"(
+Doc Label transformation [transformation ... ]
+Applies given complex transformation to the shape at Label from Document.
+The label may contain a reference to a shape, an assembly or simple shape.
+The assembly or simple shape should not be referred by any reference.
+Transformations:
+  '-move x y z'                     - move shape
+  '-rotate x y z dx dy dz angle'    - rotate shape
+  '-scale [x y z] factor'           - scale shape
+Transformations are applied from left to right.
+There can be more than one transformation of the same type.
+At least one transformation must be specified.
+)"
+          __FILE__, setLocation, g);

Please heal the style and syntax.
+)"
+          __FILE__,

Need to add ',' between FILE and end of the string.
const TCollection_AsciiString anXYZ

Incorrect name, use aXYS; I think this variable is not needed, theArgVec[0], theArgVec[1], theArgVec[2] is enoungt.
+  if (!anXYZ[0].IsRealValue (Standard_True)
+  || !anXYZ[1].IsRealValue (Standard_True)
+  || !anXYZ[2].IsRealValue (Standard_True))
+  {
+    return Standard_False;
+  }

No message info
+    Message::SendFail() << "Error: not enough arguments, see help " << theArgVec[0] << " for details\n";
+    Message::SendFail() << "Error: " << theArgVec[1] << " is not a document\n";
+    Message::SendFail() << "Error: no such Label: " << theArgVec[2] << "\n";

Do not use '\n\ with Message in the end of the message.

What about matrix? if I want use XGetLocation and get string of matrix transformation?

+    if (aShapeLabel == aRefLabel)
+    {
+      Message::SendInfo() << "New location was set";
+    }
+    else
+    {
+      TCollection_AsciiString aLabelStr;
+      TDF_Tool::Entry(aRefLabel, aLabelStr);
+      Message::SendInfo() << "Reference to the shape at label " << aLabelStr << " was created and location was set";
+    }

For this messages we need special flag. For example, "silent" of something else.
04Commenter 1
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
05Commenter 3
Commenter 3
Dmitry, your comments are taken into account.

Transformations are limited to simple actions that are obvious to the user: moving, rotating, scaling.
The raw transformation matrix is not obvious to the DRAW user.
We can set the location to the assembly if the assembly is a free shape (i.e. it hasn't reference to itself).
06Commenter 6
Branch [archived branch] has been reviewed
07Commenter 1
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: atereshi
Date: Mon Oct 31 19:12:52 2022 +0300

    # fix warning
08Commenter 1
Branch [archived branch] has been deleted by Participant.

[revision removed]