Centermarks.AddByWorkFeature on drawing view with view break.

Centermarks.AddByWorkFeature on drawing view with view break.

lmc.engineering
Advocate Advocate
669 Views
10 Replies
Message 1 of 11

Centermarks.AddByWorkFeature on drawing view with view break.

lmc.engineering
Advocate
Advocate

Hi all,

 

I am adding some dimensions to a drawing view using some projected centremarks from workpoints, as my geometry intent, however the issue I am running in to is that the drawing view contains a view break, and seemingly when I attempt to add a dimension using this method, after the view break operation, the dimension becomes sick because  the centremarks loose their reference as if they are being projected to the sheet without taking in to account the view break. Logically I can see why this happens, I just can't see how to fix it so that it accounts for the view break spacing. I suppose I could translate the centremarks by the view break distance, however I wonder if there is an out of the box solution?

 

The view object in this case is an assembly, and the dimension applied is a conditional overall length dimension. I am doing the following:

- Creategeomentryproxys using a workpointproxys from the occurrences in question.

- Centermarks.AddByWorkFeature on the workpoint proxys.

- CreateGeometryIntent on the centremarks.

- Add linear dimension to the GeometryIntents

 

Appreciate any insights you may have.

 

Thanks

0 Likes
670 Views
10 Replies
Replies (10)
Message 2 of 11

Zach.Stauffer
Advocate
Advocate

I ran into this same issue. I pivoted to using named edges/points to avoid this problem, although I think I was adding Sketched Symbols and not dimensions. I never could get the workpoints to be in the correct place after breaking the view. I would be interested if someone else has an actual solution to this.

0 Likes
Message 3 of 11

lmc.engineering
Advocate
Advocate

Thanks for the reply Zach.

 

Yeah I would normally use named geometry etc, however I was actually having difficulty with the named points, getting the correct geometry object for the geometry intent. Perhaps it's time I looked at that as opposed to solving this one, seems I'll have better chances of success as I have a suspicion the view break process is not actually translating and underlying, when applied. 

0 Likes
Message 4 of 11

Zach.Stauffer
Advocate
Advocate

Something I noticed is that if the edge/point isn't visible in a particular view then you can't use it in that view. So for example if you have a cube, and the named edge is on the backside of the cube as the view is looking at it, then you can't use it as geometry because that edge is never drawn in that view (it's covered up by the edge from the front face of the cube). It's very annoying. View breaks and automating drawings don't go well together in my experience. You can make it work, just takes more effort than it really should.

 

And I agree, the workpoints/etc. aren't translating correctly on the view when a break is applied. Seems like a bug to me but not one most people are going to run into.

0 Likes
Message 5 of 11

lmc.engineering
Advocate
Advocate

I can understand the need for a DrawingCurve object in the view, however I can't see how I am supposed to dimension to a point, as this doesn't seem to have a DrawingCurve either. Maybe the topic for another post, however if you have any code that gets me a DrawingCurve object from a named edge or point, I'll be ever grateful! 

0 Likes
Message 6 of 11

lmc.engineering
Advocate
Advocate

I should say, from an edge that is perpendicular to the view..

0 Likes
Message 7 of 11

Zach.Stauffer
Advocate
Advocate

Not sure that's possible. I went and looked at my code and model, and what I did was make tiny cylinders (like .01" in diameter) wherever I wanted a "point" and then named the cylinder edge something so I could find it in code. Definitely a hack but otherwise you're stuck naming a bunch of different edges so that you can pick the correct one depending on the view etc. Seemed like less of a headache to make a small cylinder where I needed a dimension to start/stop, but also only practical on certain models.

 

Message 8 of 11

Zach.Stauffer
Advocate
Advocate

Oh my code that gets me a drawing edge is this:

 

 

 protected DrawingCurve GetCurveForEdge(ComponentOccurrence occurrence, DrawingView view, string namedFeature)
        {
            const string iLogicAddinGuid = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}";
            var iLogic = Global.sharedInvApp.ApplicationAddIns.ItemById[iLogicAddinGuid];
            var iLogicAutomation = iLogic.Automation;

            Document partDoc = occurrence.Definition.Document;
            var entities = iLogicAutomation.GetNamedEntities(partDoc);
            object edgeEntity = entities.TryGetEntity(namedFeature);

            if (edgeEntity != null)
            {
                occurrence.CreateGeometryProxy(edgeEntity, out var proxyEdge);
                var curves = view.DrawingCurves[proxyEdge];
                if (curves.Count > 0) return curves[1];
            }

            return null;
        }

 

 

The way I use it is I search the assembly in the view for a certain part that has the edge I need, then pass that occurrence to this function with whatever view I'm trying to work with, and a string with the edge name. I also have a similar function that will give me the centerpoint of the line or the centerpoint of the circle if it's a circular edge I'm looking for.

Message 9 of 11

lmc.engineering
Advocate
Advocate

Thanks for sharing that, I actually do something very similar myself. C# always looks like a much nicer programming language than vb.

 

I have also used that exact hack method in the past just for pure simplicity, creating a very small face where I need a drawing curve on a point position, feels a bit dirty but it does do the job, and is certainly easier than chasing the drawing curve enumeration. I'm sure there are folks that have some nice algos for drawing curves, however I doubt most can invest the time to do such things given peoples workloads.

 

I may stare down that rabbit hole in the future, but for now I'll have to settle with workarounds.

 

Thanks again for your time.

 

 

0 Likes
Message 10 of 11

JMGunnar
Collaborator
Collaborator

Fast solution from me 

first add dimension

then create section view 

 

 

Section.PNG

Best regards Johan 

0 Likes
Message 11 of 11

lmc.engineering
Advocate
Advocate

Hi @JMGunnar, thanks for the suggestion.

 

I can see that working for future endeavors, however in this instance, I failed to mention the view I am adding a dimension to is a section view taken from a view that has already been broken... I suppose I could do the break task last but would need to modify the section sketch lines after.. Still a workaround, but good to know I can perform the tasks I need and add breaks last.. 

0 Likes