Skip to content

Commit

Permalink
#23 fixed SketchUp
Browse files Browse the repository at this point in the history
  • Loading branch information
moethu authored and moethu committed Jan 19, 2019
1 parent 3c7a5cc commit 877130a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
5 changes: 0 additions & 5 deletions Grevit.SketchUp/Grevit.SketchUp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@
<Name>Grevit.Types</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="slapi.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetDir)grevit_send.rb $(SolutionDir)"Package\APPDATA_SketchUp_SketchUp 2016_SketchUp_Plugins"
Expand Down
Binary file added Grevit.SketchUp/Grevit.SketchUp.zip
Binary file not shown.
25 changes: 14 additions & 11 deletions Grevit.SketchUp/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,41 +58,44 @@ public static ComponentCollection Translate(string filename)
transform.Data[13] /= 39.3701;
transform.Data[14] /= 39.3701;

string elementType = instance.Parent.Name.ToLower();
string family = instance.Parent.Name;
string type = instance.Parent.Name;
SketchUpNET.Component parent = instance.Parent as SketchUpNET.Component;
if (parent == null) continue;

if (instance.Parent.Description.Contains(";"))
string elementType = parent.Name.ToLower();
string family = parent.Name;
string type = parent.Name;

if (parent.Description.Contains(";"))
{
string[] data = instance.Parent.Description.Split(';');
string[] data = parent.Description.Split(';');
family = data[0];
type = data[1];
}

if (elementType.Contains("wall"))
{
foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
foreach (SketchUpNET.Surface surface in parent.Surfaces)
{
components.Items.Add(new WallProfileBased(family, type, new List<Types.Parameter>(), surface.ToGrevitOutline(transform), "") { GID = instance.Guid });
}
}
else if (elementType.Contains("grid"))
{
foreach (SketchUpNET.Edge edge in instance.Parent.Edges)
foreach (SketchUpNET.Edge edge in parent.Edges)
{
components.Items.Add(new Grid(new List<Types.Parameter>(), edge.Start.ToGrevitPoint(transform), edge.End.ToGrevitPoint(transform), instance.Parent.Name) { GID = instance.Guid });
components.Items.Add(new Grid(new List<Types.Parameter>(), edge.Start.ToGrevitPoint(transform), edge.End.ToGrevitPoint(transform), parent.Name) { GID = instance.Guid });
}
}
else if (elementType.Contains("line"))
{
foreach (SketchUpNET.Edge edge in instance.Parent.Edges)
foreach (SketchUpNET.Edge edge in parent.Edges)
{
components.Items.Add(new RevitLine() { curve = edge.ToGrevitLine(transform), isModelCurve = true, isDetailCurve = false, isRoomBounding = false, parameters = new List<Parameter>(), GID = instance.Guid, FamilyOrStyle = family, TypeOrLayer = type });
}
}
else if (elementType.Contains("floor"))
{
foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
foreach (SketchUpNET.Surface surface in parent.Surfaces)
{
Types.Point bottom = transform.GetTransformed(surface.Vertices[0]).ToGrevitPoint();
int ctr = surface.Vertices.Count / 2;
Expand Down Expand Up @@ -124,7 +127,7 @@ public static ComponentCollection Translate(string filename)
SketchUpNET.Vertex v = new SketchUpNET.Vertex(0, 0, 0);
Grevit.Types.Point btm = v.ToGrevitPoint(transform);

foreach (SketchUpNET.Surface surface in instance.Parent.Surfaces)
foreach (SketchUpNET.Surface surface in parent.Surfaces)
{

if (surface.Normal.Z == 1)
Expand Down
Binary file removed Grevit.SketchUp/slapi.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 877130a

Please sign in to comment.