Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Jeremy's setoutpoint

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
1012 Views, 11 Replies

Jeremy's setoutpoint

Anonymous
Not applicable

Hi,

 

Was working with setoutpoint example on structural foundations. The code places the points on one foundation but not on the other. Both of them are same family. Have attached the code[visual studio 2010 solution] and the revit project file.

 

Jeremy's setoutpoint

Hi,

 

Was working with setoutpoint example on structural foundations. The code places the points on one foundation but not on the other. Both of them are same family. Have attached the code[visual studio 2010 solution] and the revit project file.

 

11 REPLIES 11
Message 2 of 12
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Dear Sanjaymann,

 

Thank you for stating this interesting fact.

 

Would you like to explain to us why one foundation but not on the other is processed?

 

Have you looked at it in the debugger?

 

Cheers, 

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Dear Sanjaymann,

 

Thank you for stating this interesting fact.

 

Would you like to explain to us why one foundation but not on the other is processed?

 

Have you looked at it in the debugger?

 

Cheers, 

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 12
Anonymous
in reply to: jeremytammik

Anonymous
Not applicable

 Yes while debugging the only difference that I saw was that in the case of first foundation[top one] the code steps in the highlighted section[marked in green] of the GetSolid function and in the case of the second foundation[bottom one] the code steps into the highlighed section[marked in red] of the GetSolid function ; which should not happen as they are same elements the program should step in the same code for both of them:

 

Solid GetSolid( Element e, Options opt )
{
GeometryElement geo = e.get_Geometry( opt );
Solid solid = null;
GeometryInstance inst = null;
Transform t = Transform.Identity;
foreach( GeometryObject obj in geo )
{
        solid = obj as Solid;
        if( null != solid && 0 < solid.Faces.Size )
         {
          break;
         }
inst = obj as GeometryInstance;
}


if( null == solid && null != inst )
{
      geo = inst.GetSymbolGeometry();
      t = inst.Transform;

      foreach( GeometryObject obj in geo )
        {
         solid = obj as Solid;

          if( null != solid && 0 < solid.Faces.Size )
            {
             break;
            }
       }
}
return solid;
}

 

Thanks & Regards

0 Likes

 Yes while debugging the only difference that I saw was that in the case of first foundation[top one] the code steps in the highlighted section[marked in green] of the GetSolid function and in the case of the second foundation[bottom one] the code steps into the highlighed section[marked in red] of the GetSolid function ; which should not happen as they are same elements the program should step in the same code for both of them:

 

Solid GetSolid( Element e, Options opt )
{
GeometryElement geo = e.get_Geometry( opt );
Solid solid = null;
GeometryInstance inst = null;
Transform t = Transform.Identity;
foreach( GeometryObject obj in geo )
{
        solid = obj as Solid;
        if( null != solid && 0 < solid.Faces.Size )
         {
          break;
         }
inst = obj as GeometryInstance;
}


if( null == solid && null != inst )
{
      geo = inst.GetSymbolGeometry();
      t = inst.Transform;

      foreach( GeometryObject obj in geo )
        {
         solid = obj as Solid;

          if( null != solid && 0 < solid.Faces.Size )
            {
             break;
            }
       }
}
return solid;
}

 

Thanks & Regards

Message 4 of 12
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Dear Sanjaymann,

 

Aaah!

 

Well, there you are, then.

 

Apparently, the GetSolid code is not perfect for all kinds of foundations in all situations.

 

Please be aware that the samples I present have undergone extremely limited testing and contain sample code only.

 

You will always need to test and improve them for your real life working models.

 

In this case, it appears that the GetSolid method needs some improvement to handle all the cases you encounter.

 

Please research and apply those improvements, and let us know what solution you come up with to handle all the cases you need.

 

I will happily publish an enhanced version for Revit 2015 once the necessary changes are known.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Dear Sanjaymann,

 

Aaah!

 

Well, there you are, then.

 

Apparently, the GetSolid code is not perfect for all kinds of foundations in all situations.

 

Please be aware that the samples I present have undergone extremely limited testing and contain sample code only.

 

You will always need to test and improve them for your real life working models.

 

In this case, it appears that the GetSolid method needs some improvement to handle all the cases you encounter.

 

Please research and apply those improvements, and let us know what solution you come up with to handle all the cases you need.

 

I will happily publish an enhanced version for Revit 2015 once the necessary changes are known.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 12
Anonymous
in reply to: jeremytammik

Anonymous
Not applicable

Sure I will do some R&D.

 

But in this case both foundations are absolutely same family.

 

Thanks & Regards

 

0 Likes

Sure I will do some R&D.

 

But in this case both foundations are absolutely same family.

 

Thanks & Regards

 

Message 6 of 12
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Thank you. 

 

The difference may be caused by the fact that one foundation can use the unmodified family symbol geometry, whereas the other one needs some kind of instance specific modification, and therefore cannot use the unmodified symbol geometry. Does that make sense?



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Thank you. 

 

The difference may be caused by the fact that one foundation can use the unmodified family symbol geometry, whereas the other one needs some kind of instance specific modification, and therefore cannot use the unmodified symbol geometry. Does that make sense?



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 12
Anonymous
in reply to: jeremytammik

Anonymous
Not applicable

 

Some times sword fail and needle does the job.

 

While looping the corners 

 

foreach( XYZ p in corners.Keys )

 

the point p has to be transformed

 

XYZ p1 = t.OfPoint(p);
FamilyInstance fi= doc.Create.NewFamilyInstance( p1,symbols[1], StructuralType.NonStructural );

 

One line did the trick.

 

0 Likes

 

Some times sword fail and needle does the job.

 

While looping the corners 

 

foreach( XYZ p in corners.Keys )

 

the point p has to be transformed

 

XYZ p1 = t.OfPoint(p);
FamilyInstance fi= doc.Create.NewFamilyInstance( p1,symbols[1], StructuralType.NonStructural );

 

One line did the trick.

 

Message 8 of 12
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Dear Sanjaymann,

 

Congratulatins on finding the right needle for the job!

 

Thank you very much for your research!

 

Motivated by your work, I now created a GitHub repository for the SetoutPoints application and migrated it to Revit Structure 2015:

 

https://github.com/jeremytammik/SetoutPoints

 

It works fine in its current state, as far as I can tell.

 

I have not yet applied the change that you suggest, though.

 

Where exactly are you getting the transformation 't' from that you are applying to the point 'p' to determine 'p1', please?

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Dear Sanjaymann,

 

Congratulatins on finding the right needle for the job!

 

Thank you very much for your research!

 

Motivated by your work, I now created a GitHub repository for the SetoutPoints application and migrated it to Revit Structure 2015:

 

https://github.com/jeremytammik/SetoutPoints

 

It works fine in its current state, as far as I can tell.

 

I have not yet applied the change that you suggest, though.

 

Where exactly are you getting the transformation 't' from that you are applying to the point 'p' to determine 'p1', please?

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 12
Anonymous
in reply to: jeremytammik

Anonymous
Not applicable

For getting the transformation t I have moved the code from GetSolid function to the main code and used the t from this code on point p

 

GeometryElement geo = e.get_Geometry(opt);
Solid solid = null;
GeometryInstance inst = null;
Transform t = Transform.Identity;
foreach (GeometryObject obj in geo)
{
solid = obj as Solid;
if (null != solid
&& 0 < solid.Faces.Size)
{
break;
}
inst = obj as GeometryInstance;
}
if (null == solid && null != inst)
{
Transform tr=GetProjectLocationTransform(doc);
geo = inst.GetSymbolGeometry();
t = inst.Transform;

foreach (GeometryObject obj in geo)
{
solid = obj as Solid;

if (null != solid
&& 0 < solid.Faces.Size)
{
break;
}
}
}

 

I know this would be off the topic but why do I never see any job opening for Revit programming.

 

Thanks & Regards

0 Likes

For getting the transformation t I have moved the code from GetSolid function to the main code and used the t from this code on point p

 

GeometryElement geo = e.get_Geometry(opt);
Solid solid = null;
GeometryInstance inst = null;
Transform t = Transform.Identity;
foreach (GeometryObject obj in geo)
{
solid = obj as Solid;
if (null != solid
&& 0 < solid.Faces.Size)
{
break;
}
inst = obj as GeometryInstance;
}
if (null == solid && null != inst)
{
Transform tr=GetProjectLocationTransform(doc);
geo = inst.GetSymbolGeometry();
t = inst.Transform;

foreach (GeometryObject obj in geo)
{
solid = obj as Solid;

if (null != solid
&& 0 < solid.Faces.Size)
{
break;
}
}
}

 

I know this would be off the topic but why do I never see any job opening for Revit programming.

 

Thanks & Regards

Message 10 of 12
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Dear Sanjaymann,

 

Thank you very much for clarifying.

 

I added the transformation as an 'out' parameter to the GetSolid method instead of moving the code out:

 

https://github.com/jeremytammik/SetoutPoints/commit/13e134375c38573c9f45d755973359b98681db7c

 

The updated solution for Revit 2015 with your transformation added is now published on GitHub:

 

https://github.com/jeremytammik/SetoutPoints

 

You transformation enhancement is the content ot release 2015.0.0.1:

 

https://github.com/jeremytammik/SetoutPoints/releases/tag/2015.0.0.1

 

I'll point this all out on The Building Coder, in the hope that it is of interest to others as well.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Dear Sanjaymann,

 

Thank you very much for clarifying.

 

I added the transformation as an 'out' parameter to the GetSolid method instead of moving the code out:

 

https://github.com/jeremytammik/SetoutPoints/commit/13e134375c38573c9f45d755973359b98681db7c

 

The updated solution for Revit 2015 with your transformation added is now published on GitHub:

 

https://github.com/jeremytammik/SetoutPoints

 

You transformation enhancement is the content ot release 2015.0.0.1:

 

https://github.com/jeremytammik/SetoutPoints/releases/tag/2015.0.0.1

 

I'll point this all out on The Building Coder, in the hope that it is of interest to others as well.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 11 of 12
jeremytammik
in reply to: Anonymous

jeremytammik
Autodesk
Autodesk

Dear Sanjaymann,

 

Regarding your question about a job opening for Revit programming, I keep hearing request from people searching for help in that area.

 

You can submit a comment on my old blog post on 

 

Finding a Development Partner

 

 

http://thebuildingcoder.typepad.com/blog/2011/12/finding-a-development-partner.html

 

I plan to update it sometime soon anyway.

 

Anybody else interested in offering his or her services is also welcome to submit comments on that post to be updated soon.

 

Thank you!

 

Autodesk is also looking for new employees, but we are more interested in cloud and mobile related skills:

 

http://thebuildingcoder.typepad.com/blog/2014/05/new-york-travel-preparation-and-adn-job-opening.htm...

 

http://thebuildingcoder.typepad.com/blog/2014/07/the-road-ahead.html

 

http://thebuildingcoder.typepad.com/blog/2014/09/job-opportunities-events-plans-and-planes.html#2

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Dear Sanjaymann,

 

Regarding your question about a job opening for Revit programming, I keep hearing request from people searching for help in that area.

 

You can submit a comment on my old blog post on 

 

Finding a Development Partner

 

 

http://thebuildingcoder.typepad.com/blog/2011/12/finding-a-development-partner.html

 

I plan to update it sometime soon anyway.

 

Anybody else interested in offering his or her services is also welcome to submit comments on that post to be updated soon.

 

Thank you!

 

Autodesk is also looking for new employees, but we are more interested in cloud and mobile related skills:

 

http://thebuildingcoder.typepad.com/blog/2014/05/new-york-travel-preparation-and-adn-job-opening.htm...

 

http://thebuildingcoder.typepad.com/blog/2014/07/the-road-ahead.html

 

http://thebuildingcoder.typepad.com/blog/2014/09/job-opportunities-events-plans-and-planes.html#2

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 12 of 12
jeremytammik
in reply to: jeremytammik

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report