Diameter Dimensions for Sweep Profile

Diameter Dimensions for Sweep Profile

Mustafa.Salaheldin
Collaborator Collaborator
1,051 Views
14 Replies
Message 1 of 15

Diameter Dimensions for Sweep Profile

Mustafa.Salaheldin
Collaborator
Collaborator

Hello
I have created a sweep using a circle profile and a path. Now I need to add a Diameter Dimension to the arc inside the profile. Any thoughts?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
1,052 Views
14 Replies
Replies (14)
Message 2 of 15

jeremy_tammik
Alumni
Alumni

Is this inside a family definition, or where? Have you researched how to achieve the desired result manually in the UI? What are the exact steps to achieve that?

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

Hello @jeremy_tammik 
Yes, I'm trying this in Family Editor, here is my code:

 

IList<ElementId> elementIds = sweep.ProfileSketch.GetAllElements();
foreach (ElementId elemid in elementIds)
{
    Element element = family.GetElement(elemid);                                
    if (element is ModelArc marc)
    {
        if (marc.GeometryCurve is Arc arc)
        {
            FilteredElementCollector views = new FilteredElementCollector(family).OfCategory(BuiltInCategory.OST_Views).OfClass(typeof(View3D));
            View3D v = views.FirstOrDefault(v => v.Name == "{3D}") as View3D;
            Reference arcRef = arc.Reference;
            XYZ origin = arc.Center;
            family.FamilyCreate.NewDiameterDimension(v, arcRef, origin);
        }
    }
}

 

 

And it is achievable by UI, edit any Conduit Fitting Family that is created using a sweep. Edit the sweep -> Edit the Profile -> Put Diameter Dimension on the Profile curves.

MustafaSalaheldin_0-1729677528834.png


My problem is with line 13 it throws error: 

MustafaSalaheldin_1-1729677679033.png

 

Please advise 😃

 

 


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 4 of 15

ctm_mka
Collaborator
Collaborator

my guess based on your code would be the view, try any 3d view that isn't the default {3D}. If that isn't it then i suspect it doesn't it like 3D views at all.

0 Likes
Message 5 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

@ctm_mka No mate the 3D view has nothing to do with this. I suspect the "Origin" parameter, seems like it needs to be something else. 


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 6 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

One quick point that is worth to mention is adding the diameter dimension is only allowed in sketch edit mode of the profile. Not sure if this is the cause, but let us see what it could be!


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 7 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

Another quick note: when using Lookup to investigate the diameter dimension I created manually it shows the same "arcRef" and "origin" I set. The difference is "view" shows null and instead arcRef it shows references.

MustafaSalaheldin_0-1730030562712.png

 

Note: I used the dimension ID to search for the element in Lookup 😄


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 8 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

@jeremy_tammik can you please advise?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 9 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

@naveen.kumar.t would you please check with the development team if this is not a bug in Revit 2022.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 10 of 15

ctm_mka
Collaborator
Collaborator

@Mustafa.Salaheldincurious, if you manually edit the sketch of the profile, and snoop active view, what does it return?

0 Likes
Message 11 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

@ctm_mka This is impossible, during edit mode Lookup is deactivated

MustafaSalaheldin_0-1730375170367.png

The only way is as I showed you before, get the id of the curve or the dimension, use it outside the sweep/profile edit in mode Lookup to get to the dimension.

 


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 12 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

I need to know if this is a bug in the API or this method is not supported in sketch mode.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 13 of 15

jeremy_tammik
Alumni
Alumni

Dear Mustafa, 

   

Sorry for not jumping in sooner. I am on leave and therefore trying to remain completely inactive here. I'm afraid I am not completely succeeding...

  

I asked the development team for you.

  

Cheers

  

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 14 of 15

Mustafa.Salaheldin
Collaborator
Collaborator

@jeremy_tammik appreciated and enjoy your vacation. 🖖


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 15 of 15

studio-a-int
Advocate
Advocate

We ran into a similar issue, and we gave up after few tries. In Revit 2023/2024 in Families trying to add a Diameter Dimension to a Model Line fails with the same error as yours. We did not have time to investigate too much, but it is simple to replicate:

 

In a Family, create a SketchPlane where the curve is.
Create an arc from a curve.
Create a ModelCurve from the arc in the SketchPlane.
Try to create NewDiameterDimension to the ModelCurve -> it fails with the same error message.
---------------------------
Error
---------------------------
Error: One of the conditions for the inputs was not satisfied. Consult the documentation for requirements for each argument.
---------------------------
OK
---------------------------

 

 

0 Likes