Skip to content

Commit

Permalink
ADD: rhino plugin basic structure
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasvestartas committed Oct 15, 2024
1 parent a42ffc5 commit 38149ce
Show file tree
Hide file tree
Showing 19 changed files with 1,079 additions and 169 deletions.
2 changes: 0 additions & 2 deletions src/compas_wood/binding/binding_beam_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from wood_nano import point3
from wood_nano import cut_type2

# from wood_nano.conversions_python import from_cut_type2


def beam_volumes(
input_polyline_axes,
Expand Down
14 changes: 5 additions & 9 deletions src/rhino/plugin/commands/w_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def read_xml_polylines(
return polylines


def load_data_set(): # path: str = "C://brg//2_code//compas_wood//src//rhino//plugin//shared//datasets"
def load_data_set(): # path: str = "C://brg//2_code//compas_wood//src//rhino//plugin//shared//datasets"
"""Load datasets from xml files.
Parameters
Expand Down Expand Up @@ -87,27 +87,23 @@ def load_data_set(): # path: str = "C://brg//2_code//compas_wood//src//rhino//pl

return file_names_without_extensions


def my_callback(name_value_type, dataset_name):

if len(input_dict["polylines"][0])>0:
if len(input_dict["polylines"][0]) > 0:
dataset_name = "default"
wood_rui_globals.init_data(dataset_name)
add_polylines(input_dict["polylines"][0],dataset_name)


add_polylines(input_dict["polylines"][0], dataset_name)


if __name__ == "__main__":



# Define the input dictionary based on your initial dataset
input_dict = {
"library": (load_data_set, Callable), # Default value for weld radius (float)
"library": (load_data_set, Callable), # Default value for weld radius (float)
"polylines": ([], List[Rhino.Geometry.Polyline]), # Default value for polylines (list of polylines)
}

# Call the generalized input method with the dataset name and input dictionary
dataset_name = "default"
generalized_input_method(dataset_name, input_dict, my_callback)

17 changes: 8 additions & 9 deletions src/rhino/plugin/commands/w_dataset_annen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
ensure_layer_exists,
add_polylines,
add_mesh,
add_insertion_lines,
add_adjacency,
add_insertion_vectors,
add_three_valence,
Expand Down Expand Up @@ -755,7 +754,6 @@ def run(self, dataset_name):
add_three_valence(self.three_valence, dataset_name)
add_adjacency(self.adjacency, dataset_name)


# _data = WoodData(
# chevron.plines,
# chevron.insertion_vectors,
Expand Down Expand Up @@ -1094,13 +1092,14 @@ def update():

# ToDo: use uncomment and try the code below to access the shared folder:
# Step 1: import geometry from step file if layer "surface" is empty
# guid = System.Guid("D0647BA8-EEE5-4C18-AB3E-03A95F119654")
# plugin_file: str = Rhino.PlugIns.PlugIn.PathFromId(guid)
# plugin_path: str = System.IO.Path.GetDirectoryName(plugin_file)
# data_sets: str = System.IO.Path.Combine(plugin_path, "shared")
# step_file_path = System.IO.Path.Combine(data_sets, "annen.stp")

step_file_path = r"C:\brg\2_code\compas_wood\src\rhino\plugin\shared\datasets\annen.stp"
guid = System.Guid("D0647BA8-EEE5-4C18-AB3E-03A95F119654")
plugin_file: str = Rhino.PlugIns.PlugIn.PathFromId(guid)
plugin_path: str = System.IO.Path.GetDirectoryName(plugin_file)
data_sets: str = System.IO.Path.Combine(plugin_path, "shared")
step_file_path = System.IO.Path.Combine(data_sets, "annen.stp")
print(step_file_path)

# step_file_path = r"C:\brg\2_code\compas_wood\src\rhino\plugin\shared\datasets\annen.stp"
new_layer_name = "compas_wood::annen::surface"
imported_objects = import_step_file(step_file_path, new_layer_name)

Expand Down
Loading

0 comments on commit 38149ce

Please sign in to comment.