def get_inventor(self):
     try:
         oApp = GetActiveObject('Inventor.Application')
     except Exception as e:
         print(e)
         oApp = Dispatch('Inventor.Application')
         oApp.Visible = True
     self._mod = gencache.EnsureModule(
         '{D98A091D-3A0F-4C3E-B36E-61F62068D488}', 0, 1, 0)
     self._application = self._mod.Application(oApp)
import math
from win32com.client import Dispatch, GetActiveObject, gencache, constants 
try:
    invApp = GetActiveObject('Inventor.Application')
except:
    invApp = Dispatch('Inventor.Application')
    invApp.Visible = True

mod = gencache.EnsureModule('{D98A091D-3A0F-4C3E-B36E-61F62068D488}', 0, 1, 0)
invApp = mod.Application(invApp)
# invApp.SilentOperation = True

# Create a new part
invDoc = invApp.Documents.Add(constants.kPartDocumentObject, "", True)

# Casting Document to PartDocument
invPartDoc = mod.PartDocument(invDoc)

compdef = invPartDoc.ComponentDefinition

# Create a sketch
xyPlane = compdef.WorkPlanes.Item(3)
origin_point = invApp.TransientGeometry.CreatePoint(0, 0, 0)
x_axis = invApp.TransientGeometry.CreateUnitVector(1, 0, 0)
y_axis = invApp.TransientGeometry.CreateUnitVector(0, 1, 0)

l = 4
h = 2*(3**0.5)
r = 4/(3**0.5)
for i in range(0, 30):
    angle = i*0.1
#%%
try:
    n += 1
    c3d1 = acad.GetInterfaceObject("AeccXUiLand.AeccApplication.9.0")
    n += 1
    c3d2 = acad.GetInterfaceObject("AeccXUiRoadway.AeccRoadwayApplication.9.0")
    n += 1
    #c3d1 = CreateObject("AeccXUiLand.AeccApplication.9.0")
    #c3d2 = CreateObject("AeccXUiRoadway.AeccRoadwayApplication.9.0")
    pass
except Exception as error:
    print(error)
    print('\n' + str(n))

try:
    acad.Visible = True
    pass
except:
    pass

print('\33aaaaa')

# %%
x = np.linspace(0, 4, 12)
y = np.cos(x**2 / 3 + 4)
print(x, y)
plt.plot(x, y)
#%%

from numpy import cos, sin, pi, arccos as acos
Example #4
0
def _connect_to_running_excel(visible=True):
    xl = GetActiveObject('Excel.Application')
    xl.Visible = visible

    return xl
Example #5
0
def main():
    uiApplication = GetActiveObject('STK12.Application')
    uiApplication.Visible = True
    root = uiApplication.Personality2

    graph = Graph("bolt://localhost:7687", auth=("neo4j", "ssr"))
    ASO_type = int(input("Enter 1 or 2 to score either: (1) an ASO already in orbit or (2) a new ASO - "))

    if ASO_type == 1:
        norad_id = input("Input the NORAD ID for the ASO you want to score: ")

        aso_orb = query_orbit(norad_id, graph)

    elif ASO_type == 2:
        aso_orb = {}
        SMA = float(input("Enter the planned semimajor axis in kilometers: "))
        aso_orb['SMA'] = SMA * 1000
        inclination = float(input("Enter the planned inclination of the orbit in degrees: "))
        aso_orb['Inc'] = math.radians(inclination)
        eccentricity = float(input("Enter the planned eccentricity of the orbit: "))
        aso_orb['Ecc'] = eccentricity
        raan = float(input("Enter the planned right ascension of the ascending node in degrees: "))
        aso_orb['RAAN'] = math.radians(raan)
        argp = float(input("Enter the planned argument of perigee in degrees: "))
        aso_orb['ArgP'] = math.radians(argp)

    scenario = root.CurrentScenario

    # build satellite
    satellite = scenario.Children.New(18, "ASO")
    keplerian = satellite.Propagator.InitialState.Representation.ConvertTo(1)
    keplerian.LocationType = 5
    keplerian.SizeShape.Eccentricity = aso_orb['Ecc']
    keplerian.SizeShape.SemiMajorAxis = aso_orb['SMA'] / 1000
    keplerian.Orientation.Inclination = math.degrees(aso_orb['Inc'])
    keplerian.Orientation.ArgOfPerigee = math.degrees(aso_orb['ArgP'])  # deg
    keplerian.Orientation.AscNode.Value = math.degrees(aso_orb['RAAN'])  # deg
    keplerian.Location.Value = 0

    # Apply the changes made to the satellite's state and propagate:
    satellite.Propagator.InitialState.Representation.Assign(keplerian)
    satellite.Propagator.Propagate()

    # detectability scoring
    radar_detect_results = pd.DataFrame(columns=['Metric', 'Value', 'Tier', 'Score'])
    prob_detection = radar_detectability(root)
    radar_detect_results = fill_d_dataframe(radar_detect_results, prob_detection)
    print(radar_detect_results)
    # optical_detectability(root)

    # trackability scoring
    radar_results = pd.DataFrame(columns=['Metric', 'Value', 'Tier', 'Score'])
    optical_results = pd.DataFrame(columns=['Metric', 'Value', 'Tier', 'Score'])

    avg_pass, avg_coverage, avg_interval = radar_trackability(aso_orb, root)
    opt_pass, opt_coverage, opt_int = optical_trackability(aso_orb, root)
    radar_results = fill_dataframe(radar_results, avg_pass, avg_coverage, avg_interval)
    optical_results = fill_dataframe(optical_results, opt_pass, opt_coverage, opt_int)

    print(radar_results)
    radar_score = radar_results['Score'].mean()
    print("\nOverall T Radar Score: {}\n".format(radar_score))
    print(optical_results)
    optical_score = optical_results['Score'].mean()
    print("\nOverall T Optical Score: {}".format(optical_score))