Skip to content

Conversation

@9and3
Copy link
Contributor

@9and3 9and3 commented Aug 22, 2024

description

This PR introduces 2 new components. One for visualizing the dfassembly and one for cullind dfbeams from the dfassembly.

  • DFPreviewAssembly

component: this is a component showing the ids + extra widgets for the dfassembly. Now the DFBuildAssembly component is also assigning ids for the beams once created. DFBeams have now a assembly_index attribute. All future visualizations for dfAssembly can be added in this component.

e.g.:

  • DFRemoveBeam

component: this is removing beams from the assembly based on indexes. I had to implement deepcopy() funcs in all the df_geometries to make it functioning otherwise it would modify the same DFAssembly object all across th canvas. Now it returns a new DFAssembly object with less beams.

e.g.:

fixes

  • introduced from . import df_cvt_bindings into __init__.py of diffCheck to avoid raising error
  • the DFFace had a check in the def __post_init__() that broke now for some reasons. Got rid of it.
  • fixed a bug in __repr__() func for DFFace

caveats

  • the component DFPreviewAssembly when linked to the DFRemoveBeam presents a tiny lag in the preview. I do not why. I won't mark it as an issue for now but it needs to be tested further for big structures.

@9and3 9and3 self-assigned this Aug 22, 2024
@9and3 9and3 added enhancement New feature or request grasshopper PythonAPI labels Aug 22, 2024
@9and3 9and3 linked an issue Aug 23, 2024 that may be closed by this pull request
@9and3 9and3 marked this pull request as ready for review August 25, 2024 13:38
@9and3
Copy link
Contributor Author

9and3 commented Aug 25, 2024

Ready for review! @eleniv3d / @DamienGilliard

@9and3 9and3 changed the title Remove DFBeams from DFAssembly Remove DFBeams from DFAssembly + Preview DFAssembly Aug 25, 2024
@9and3 9and3 changed the title Remove DFBeams from DFAssembly + Preview DFAssembly Remove DFBeams + Preview DFAssembly Aug 25, 2024
@DamienGilliard
Copy link
Collaborator

@9and3 , the issue with the arrows being slow to display is not isolated:
https://discourse.mcneel.com/t/can-drawviewportmeshes-run-async/190159

I didn't find a solution yet, though

Copy link
Collaborator

@DamienGilliard DamienGilliard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @9and3 for this ! I will spend ideally 2 hours tomorrow to help fix the lag issue. otherwise no comment except for the deepcopy() methods as mentioned in the comments.

if i_assembly is None or i_idx_2_remove is None:
return None

o_assembly = i_assembly.deepcopy()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is not where the issue of the lag appears. That the deepcopy() is not 100% a deep copy and therefore some objects are shared between components... This is only an intuition and I will spend a bit more time on that tomorrow 28/8

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good hint acutally. Tell me if you find something fishy in the deepcopy() func!

beam_axis = rg.Line(obb_endfaces[0].GetBoundingBox(True).Center, obb_endfaces[1].GetBoundingBox(True).Center)
extension_length = 0.5 * diffCheck.df_util.get_doc_2_meters_unitf()
beam_axis.Extend(extension_length, extension_length)
args.Display.DrawArrow(beam_axis, System.Drawing.Color.Magenta)
Copy link
Collaborator

@DamienGilliard DamienGilliard Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to append the lines in a list and use args.Display.DrawArrows(list_of_line) but it didn't help the lag issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed today it seems to be a problem with not only the arrows but also lines but I truly think that having a better look at deepcopy() might help, we can also do this on Thursday together @DamienGilliard !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved it in e9d0253: it was simply safer to use the native copymodule and just do:

o_assembly = copy.copy(i_assembly)

no more lag in the preview

@9and3
Copy link
Contributor Author

9and3 commented Aug 29, 2024

Lag preview and custom preview esthetics are solved, merging this one, thank you @DamienGilliard for your feedback! 👐

@9and3 9and3 merged commit fae11c7 into main Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New component for getting rid beams from the DFAssembly

3 participants