Closed vikasTmz closed 7 years ago
I have a strange error when I open blender, enter in edit mode and select get vertices
on a 3D face feature
@vikasTmz Nice work, nice solution. @fspindle Did you try to select only the (4) points that belong to a face?
@s-trinh You are right, this was my issue I don't know if it would be possible to detect this user bad usage and print a nicer warning
@fspindle The error was form the statement bpy.ops.mesh.edge_face_add()
, which was called even when no missing faces were present from the selected vertices.
There may be some more cases where error handling should be done. I'll fix these now, but besides that is there any improvements?
Yes, with @s-trinh we just reviewed your work. Nice beginning. We identify some improvements that could be achieved. He will give you the complete list asap.
From a user point of view, if I introduce basically
edit mode
and pressing a new button named "Calculate center&radius" or something like thatcc @fspindle Can you take a look and correct me or add something I could have missed?
Some errors we encountered:
Improvements / new features suggestion:
Circle modeling improvement:
Cylinder modeling improvement:
What is the purpose of the button "load previous property"? It looks a little bit confusing.
At @s-trinh thanks this is what we discussed.
After a good night, I have a new suggestion to simplify the GUI:
For a circle one column with
Text: Center
coord x value
coord y value
coord z value
Text: Radius
radius value
Button: Update
The button Update
updates the values from the selection of points in edit mode
For a cylinder 3 blocks (may be organised vertically in 1 column)
In the first block
Text: Axis revolution point 1
coord x value
coord y value
coord z value
Button: Update
The button Update
updates the values from the selection of points in edit mode
In the second block
Text: Axis revolution point 2
coord x value
coord y value
coord z value
Button: Update
The button Update
updates the values from the selection of points in edit mode
In the third block
Text: Radius
radius value
Button: Update
The button Update
updates the values from the selection of points in edit mode
What do you think ?
It's good for me.
This should work. I'll see if I can add these instructions as a tool tip next to the respective buttons/fields.
Why are three points needed when the two points that are diametrically opposite are given to calculate radius can also be used to get the center?
Ok, with 2 points on the diameter you can compute the radius + center (good idea). But sometimes it could be difficult for the user to be sure that the 2 points belong to the diameter.
Introducing 3 points selection allows the user to select any point on the circumference. Then on the web you will find the equations (I found for example https://math.stackexchange.com/questions/1076177/3d-coordinates-of-circle-center-given-three-point-on-the-circle and the the radius could be obtained from the center and on the points)
Nice thanks. From a quick tour, I would suggest to introduce a Clear
button to erase all the values (radius + center coords) for a circle and the same for a cylinder.
Selecting a 3D face and pressing -
to erase the face change the focus to the 3D cylinder event if there are remaining 3D faces
we did not manage to export 3D lines
This has been fixed. I only considered meshes with faces initially.
this contextual menu should be removed
This contextual menu is blender's generic right click menu that is showed on any event. I believe the contents of this menu are hard-coded though the latest version has a patch to add options to this menu. But this would then be visible on RMB click on any UI button, field etc.
I'll have to look further though to be sure if this is not possible
Should I now proceed with exporting hierarchical models and setting LOD parameters?
We prefer that you add 2 tutorials (text + screnshot + video) :
Then what we see is the developement of the Qt GUI to be able to load a cao model, display the normal of the faces. Allow to set some properties (lod, name of the face) + something to change the normal if requested by the user
Nice job.
Below some improvement suggestions:
In the exported .cao, the comment # 3D points
should be placed after the line V1
V1
# 3D points
0
# 3D lines
...
Concerning the 3D Lines
they are always exported as 3D lines (ok) AND 3D faces (should be optional)
V1
3
# 3D points
1.000000 -1.000000 -1.000000
1.000000 1.000000 -0.999999
0.999999 1.000000 1.000001
# 3D lines
3
1 2
2 0
0 1
# Faces from 3D lines
1
3 0 1 2
Since sometimes it could be interesting to track only lines (mbt edges), nor the keypoints that belong to the face defined by the lines, I suggest that we add someting to enable/disable (may be a check button ?) the face export from lines to allow:
V1
3
# 3D points
1.000000 -1.000000 -1.000000
1.000000 1.000000 -0.999999
0.999999 1.000000 1.000001
# 3D lines
3
1 2
2 0
0 1
# Faces from 3D lines
0
Done. #9 and #10.
Also is there an issue if duplicate edge keys are present under #3D Lines
? In case there is a face, I'm getting the edge_key_map
by iterating over each face(polygon) of the mesh. So edges that are common for faces are repeated.
Eg:-
V1
# 3D points
8
1.000000 -1.000000 -1.000000
1.000000 -1.000000 1.000000
-1.000000 -1.000000 1.000000
-1.000000 -1.000000 -1.000000
....
# 3D lines
16
0 1
1 2
2 3
3 0
2 1 (repeated)
....
Any other changes for this PR?
something to change the normal
This can be done in blender too for every face.
something to change the normal This can be done in blender too for every face.
Feel free to do it if the feature can be implemented easily. Otherwise it can be future improvement for the end of the project.
I did a quick test: I noticed that the object scale is not taken into account when a primitive is created in the scene. Also, I think that global or local frame should be also taken into account when getting the point coordinate.
I will experiment more in depth and give you a summary soon.
Also is there an issue if duplicate edge keys are present under #3D Lines ? In case there is a face, I'm getting the edge_key_map by iterating over each face(polygon) of the mesh. So edges that are common for faces are repeated.
Eg:-
V1
3D points
8 1.000000 -1.000000 -1.000000 1.000000 -1.000000 1.000000 -1.000000 -1.000000 1.000000 -1.000000 -1.000000 -1.000000 ....
3D lines
16 0 1 1 2 2 3 3 0 2 1 (repeated) ....
Duplicated segments like in your example is not a problem. Moreover, the order of the points will define the visibility of the face. Demo of the tracking of a cube:
The model file is:
# Blender v2.78 (sub 0) CAO File
V1
# 3D points
8
1.000000 -1.000000 -1.000000
1.000000 -1.000000 1.000000
-1.000000 -1.000000 1.000000
-1.000000 -1.000000 -1.000000
1.000000 1.000000 -0.999999
0.999999 1.000000 1.000001
-1.000000 1.000000 1.000000
-1.000000 1.000000 -1.000000
# 3D lines
24
0 1
1 2
2 3
3 0
4 7
7 6
6 5
5 4
0 4
4 5
5 1
1 0
1 5
5 6
6 2
2 1
2 6
6 7
7 3
3 2
4 0
0 3
3 7
7 4
# Faces from 3D lines
6
4 0 1 2 3
4 4 5 6 7
4 8 9 10 11
4 12 13 14 15
4 16 17 18 19
4 20 21 22 23
# Faces from 3D points
0
# 3D cylinders
0
# 3D circles
0
Another experiment with the modelling and the tracking of a cylinder + circle:
So far, the issues I noticed:
Global
or Local
coordinate is selected
- if the primitive name is changed, there is an error at the export
- maybe try to take also into account if the Global or Local coordinate is selected
Fixed
- the object scale is not taken into account
- for the circle, it is no more possible to select the first and second point, useful to define the circle visibility using the order of the points
Could you elaborate these two points?
- the object scale is not taken into account
For instance, if we change the dimension of the cube, the point coordinates are still between -1 and 1 but the scale of the object has changed. The coordinates should be scaled accordingly for me.
- for the circle, it is no more possible to select the first and second point, useful to define the circle visibility using the order of the points
The order of the 3 points used to model the circle (circle center + 2 points on the circle plane) is used to determine the normal of the circle and thus is used for the visibility test (see here). I think it is the same issue than with the 3D face case: we cannot retrieve the order of the selected points in the list. A button to switch the two point coordinates could do the trick maybe?
For instance, if we change the dimension of the cube, the point coordinates are still between -1 and 1 but the scale of the object has changed. The coordinates should be scaled accordingly for me.
Was this scale applied in Object Mode
? In blender scaling an object in Object Mode
doesn't change the mesh, thus the vertices remain the same. This has to be done in Edit Mode
.
This link covers more reasons.
Yes it is in Object Mode
. Apply the scale command should solve the issue. Maybe we should add this instruction in the tutorial, as a note.
Covers all new features raised in Issues: #3,#4,#5,#6,#7,#8,#11,#12 and #13. The
tree view
UI implemented does not match the one implemented under scene hierarchy in blender since there doesn't exist a module for it, but has all the functionalities.UIList
was used instead.Usage:
vertices/edges
are to given whenType == "3D Faces" || "3D Lines"
, then select the necessaryvertices
from the object in the scene and clickGet Vertices
. This displays the list of selectedvertices
.vertices
are separated and a newmesh
is created. Aface
is then constructed for thismesh
. Note: Thevertices
are not editable in the display panel. Useundo
to revert any changes.tree view
before exporting. All are enabled by default.tree view
and clickSelect List Item
.ViSP CAD Properties Panel
.TODO: