Hi there,
i'm trying to generate drawing view with camera position and 3D annotation from a part :
When using the code below it seems it doesn't use my pre saved view but only the view from the right and I don't keep the 3D Annotations visibilities I've saved in my view (all 3d annotations are imported).
My goal is to have only some 3D annotations in my left view and some other in my right view. Today the first view generated have all the annotations and the other none.
Any tips ?
oViewRight = oSheet.DrawingViews.AddBaseView(oDoc, oPosRight, 0.25, _ ViewOrientationTypeEnum.kRightViewOrientation, _ DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle) oViewRight.Include3DAnnotations = True oViewFront.DisplayTangentEdges = True
Fabian Perrée
Giùp.fr | LinkedIn
Ce post vous a été utile ? N'hésitez pas à aimer ce post.
Ce post a-t-il répondu à votre question ? Cliquez sur le bouton Accepter la solution.
Hi @Fabian_perree. This is not really something that I have had to do before, but I would suspect that you would have to do the following:
Just some initial thoughts.
Edit: I know of two different places to specify that you want to include 3D annotations. One can be seen if you click the little gear/cog icon next to where we specify the design view, within the smaller pop-up dialog, like you are showing in your initial post. I am not sure how to access that one by code at the moment. However, the other one is on the 'Recovery Options' tab of the Drawing View editor dialog, but is only visible / available when there are some 3D annotations in the immediately referenced model. That is the one you are accessing in your code example above. Sometimes setting that to True is all that is needed to include 'all' 3D annotations that can be seen by that view's line of sight. Trying to manage only including some of them is going to be challenging to do by code though.
Wesley Crihfield
(Not an Autodesk Employee)
Hi @WCrihfield,
Thanks a lot for your very complete answer !
I'll have a try with the differents way you gave to me, thanks a lot.
Best Regards
Fabian Perrée
Giùp.fr | LinkedIn
Ce post vous a été utile ? N'hésitez pas à aimer ce post.
Ce post a-t-il répondu à votre question ? Cliquez sur le bouton Accepter la solution.
Hi,
I do this too and works perfect for me under the condition that you apply a correct Annotation Plane parallel to the view. I do this for every dimension even if unnessecary - to be sure 😀
Hi @KurtDR,
I'll give a try to select another plane but as I've got one right and one left view the planes are parallels and all the annotations are imported in one view.
But maybe I didn't understand, could you show me the code you're using in Ilogic?
I've got good result with getting annotation from sketches with their names but I'll love to import directly the view I've already made...
Fabian Perrée
Giùp.fr | LinkedIn
Ce post vous a été utile ? N'hésitez pas à aimer ce post.
Ce post a-t-il répondu à votre question ? Cliquez sur le bouton Accepter la solution.
I did some additional testing on my end and found out that it seems like what you are trying to do is very possible, with the right preparations ahead of time.
I had a weldment type assembly I was working on, added several 3D model dimensions, and a couple 3D annotation Leader Text notes. I did this for two different views of the model, and made sure there was a DVR for both views. After all annotations were present, I made sure only the ones I wanted to see in each view were visible while their DVR's were active, so the DVR's would record those visibility settings. I even turned one or another off (visibly) in each view, as an additional test. When I created the drawing view by code, the way I mentioned above, the views, and the specific 3D model annotations being automatically included in them, were just as expected (only the ones visible in the specified DVR). The reason I am specifying 'right' view orientation, but then 'FRONT' DVR, is due to ViewCube being different than what I would prefer, but I do not like to modify the ViewCube from its default. Instead I generally design stuff with the ViewCube's orientation in mind, so that it ends up the way I want, obviously with some exceptions here and there, when it is not important.
Below is a modified version of the code I used when testing, that worked OK for me.
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oViews As DrawingViews = oSheet.DrawingViews
Dim oBView As DrawingView = Nothing
Dim sModelFile As String = "C:\Temp\MyWeldment.iam"
Dim oModelDoc As Inventor.Document = ThisApplication.Documents.Open(sModelFile, False)
Dim oPosition As Inventor.Point2d = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width / 4, oSheet.Height / 4)
Dim dScale As Double = (1/23)
Dim oVO As ViewOrientationTypeEnum = ViewOrientationTypeEnum.kRightViewOrientation
Dim oVStyle As DrawingViewStyleEnum = DrawingViewStyleEnum.kShadedDrawingViewStyle
Dim sMViewName As String = "FRONT"
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Add("WeldmentFeatureGroup", WeldmentFeatureGroupEnum.kWeldsFeatureGroup)
oOptions.Add("DesignViewRepresentation", "FRONT")
oOptions.Add("DesignViewAssociative", True)
oOptions.Add("Include3DAnnotations", True)
Try
oBView = oViews.AddBaseView(oModelDoc, oPosition, dScale, oVO, oVStyle, sMViewName, , oOptions)
Catch ex As Exception
Logger.Error("AddBaseView method error." & vbCrLf & ex.Message & vbCrLf & ex.StackTrace)
End Try
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Thank you again @WCrihfield,
Unfortunatly my document is a part doc so, as specified in the help regarding ModelViewName :
This argument is ignored if the document type specified by the Model argument is a part file (.ipt)
I could make an assembly with only my part inside but I don't think it's a a good practice.
For now I think i'll do with this :
Dim oDims As GeneralDimensions oDims = oSheet.DrawingDimensions.GeneralDimensions Dim oRetrievableDims As ObjectCollection oRetrievableDims _ = ThisApplication.TransientObjects.CreateObjectCollection oRetrievableDims = oDims.GetRetrievableDimensions(oViewFront) If oRetrievableDims.Count > 0 Then Dim dimsEnum As GeneralDimensionsEnumerator dimsEnum = oDims.Retrieve(oViewFront) Dim paramName As String Dim oDim As GeneralDimension For Each oDim In dimsEnum If oDim.Retrieved Then paramName = oDim.RetrievedFrom.Parameter.Name If paramName <> "d3" And _ paramName <> "d4" Then oDim.Delete() End If End If Next End If
to retrieve only the dimensions I need in each view.
Fabian Perrée
Giùp.fr | LinkedIn
Ce post vous a été utile ? N'hésitez pas à aimer ce post.
Ce post a-t-il répondu à votre question ? Cliquez sur le bouton Accepter la solution.
Can't find what you're looking for? Ask the community or share your knowledge.