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.
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
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
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
Sure I will do some R&D.
But in this case both foundations are absolutely same family.
Thanks & Regards
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?
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.
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
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
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
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
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/07/the-road-ahead.html
http://thebuildingcoder.typepad.com/blog/2014/09/job-opportunities-events-plans-and-planes.html#2
Cheers,
Jeremy
Published:
Enjoy!
Cheers,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.