コード例 #1
0
def RunCommand(is_interactive):

    shelvepath = os.path.join(compas.APPTEMP, 'AGS', '.history')
    if not os.path.exists(os.path.dirname(shelvepath)):
        try:
            os.makedirs(os.path.dirname(shelvepath))
        except OSError as error:
            if error.errno != errno.EEXIST:
                raise

    db = shelve.open(shelvepath, 'n')
    db['states'] = []

    scene = Scene(db, 20, SETTINGS)
    scene.purge()

    sc.sticky["AGS"] = {
        'proxy': Proxy(),
        'system': {
            "session.dirname": CWD,
            "session.filename": None,
            "session.extension": 'ags'
        },
        'scene': scene,
    }

    scene.update()

    # would be useful to add a notification about the cloud: new / reconnect
    compas_rhino.display_message("AGS has started.")
コード例 #2
0
def RunCommand(is_interactive):

    if check():
        print("Current plugin is already activated")
    else:
        compas_rhino.rs.MessageBox("Detected environment change, re-activating plugin", 0, "Re-activating Needed")
        if activate():
            compas_rhino.rs.MessageBox("Restart Rhino for the change to take effect", 0, "Restart Rhino")
        else:
            compas_rhino.rs.MessageBox("Someting wrong during re-activation", 0, "Error")
        return

    shelvepath = os.path.join(compas.APPTEMP, 'AGS', '.history')
    if not os.path.exists(os.path.dirname(shelvepath)):
        try:
            os.makedirs(os.path.dirname(shelvepath))
        except OSError as error:
            if error.errno != errno.EEXIST:
                raise

    db = shelve.open(shelvepath, 'n')
    db['states'] = []

    scene = Scene(db, 20, SETTINGS)
    scene.purge()

    sc.sticky["AGS"] = {
        'proxy': Proxy(),
        'system': {
            "session.dirname": CWD,
            "session.filename": None,
            "session.extension": 'ags'
        },
        'scene': scene,
    }

    scene.update()

    # would be useful to add a notification about the cloud: new / reconnect
    # compas_rhino.display_message("AGS has started.")
    Browser()
コード例 #3
0
form.edge_force((0, 1), -1.0)
form.edge_force((2, 3), -1.0)
form.edge_force((4, 5), -1.0)

# ==============================================================================
# Equilibrium
# ==============================================================================

form.data = graphstatics.form_update_q_from_qind_proxy(form.data)
force.data = graphstatics.force_update_from_form_proxy(force.data, form.data)

# ==============================================================================
# Visualize
# ==============================================================================

scene = Scene()

form_id = scene.add(form, name="Form", layer="AGS::FormDiagram", visible=True)
force_id = scene.add(force,
                     name="Force",
                     layer="AGS::ForceDiagram",
                     visible=True)

scene.clear_layers()

form_obj = scene.find(form_id)
force_obj = scene.find(force_id)

# this should become part of "add"
force_obj.anchor = 5
force_obj.location = [35, 0, 0]
コード例 #4
0
force.data = graphstatics.force_update_from_form_proxy(force.data, form.data)

# Pick one key and move
move_key = 2
delta = +0.1
moving_point = force.vertex_coordinates(move_key)
force.vertex_attribute(move_key, 'x', moving_point[0] + delta)
force.vertex_attribute(move_key, 'y', moving_point[1] + delta)

# Create Scene

from compas_ags.utilities import check_deviations
if not check_deviations(form, force):
    compas_rhino.display_message('Error: Diagrams are not in equilibrium!')

scene = Scene()

form_id = scene.add(form, name="Form", layer="AGS::FormDiagram")
force_id = scene.add(force, name="Force", layer="AGS::ForceDiagram")

form_obj = scene.find(form_id)
force_obj = scene.find(force_id)

force_obj.artist.anchor_vertex = 5
force_obj.artist.anchor_point = [35, 0, 0]
force_obj.artist.scale = 5.0

scene.update()

# if not checked:
#     from compas_plotters import MeshPlotter