Creating a Detail View in drawing with iLogic

Creating a Detail View in drawing with iLogic

Daan_M
Collaborator Collaborator
1,503 Views
3 Replies
Message 1 of 4

Creating a Detail View in drawing with iLogic

Daan_M
Collaborator
Collaborator

Hi,

 

As the title suggests, im trying to make iLogic create a Detail View, like so (done manually with UI);

Daan_M_0-1597407002827.png

 

I have the following code:

	Dim oPointDetail As Point2d
    oPointDetail = oView2.Center
    oPointDetail.X = oPointDetail.X - 0.5 * oView2.Width
    
    Dim oCurveSeg As DrawingCurveSegment
    oCurveSeg = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick")
    Dim oCenterPoint As Point2d
    oCenterPoint = oCurveSeg.StartPoint

   
    Dim oDetailView As DetailDrawingView
    oDetailView = oSheet.DrawingViews.AddDetailView(oView2, oPointDetail, kFromBaseDrawingViewStyle, True, oCentrePoint, 1, , oView2.Scale * 3, True, "Detail A")

 

i ran into two problems:

 

1. i get an error with the cause 'wrong paramater', after looking at it i found out why;

Daan_M_2-1597407267701.png

The property 'StartPoint' returns nothing when the selected DrawingCurveSegment is circular (which mine is).

How can i work around this?

 

 

2. I use a manual picker to select a DrawingCurveSegment right now, which is fine for testing, but i want this automated. The segment i need a detail of is always the same, so the goal is to define that segment in my iLogic and assign it to oCurveseg

oCurveSeg = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick")

 

Thanks in advance.

 

 

0 Likes
Accepted solutions (1)
1,504 Views
3 Replies
Replies (3)
Message 2 of 4

JelteDeJong
Mentor
Mentor

Have you seen this post? It shows how to create a drawing from scratch inclusive creating a detail view.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 4

Daan_M
Collaborator
Collaborator
Accepted solution

Thanks I've managed to place a detailview in the position and scale i want;

Dim DCP As Point2d
	DCP =  oV2Cm4.Position
	
	Dim DPPV As Double = (oSheet.Height - 15) 
	Dim DPPH As Double = (oSheet.Width - 25) 
 
	Dim DPP As Point2d 
        DPP = ThisApplication.TransientGeometry.CreatePoint2d(DPPH, DPPV) 

  	Dim oPointDetail As Point2d
    oPointDetail = oView2.Center
    oPointDetail.X = oPointDetail.X - 0.5 * oView2.Width
    
    Dim oDetailView As DetailDrawingView
    oDetailView = oSheet.DrawingViews.AddDetailView(oView2, DPP, kFromBaseDrawingViewStyle, True, DCP, 0.5, , oView2.Scale * 2, True, "A")
	

 

I'm stuck at placing the annotations on the detail view. I'm not sure how i should create the centermarks, for centermarks on my regular views i use; 

Dim oCMs As Centermarks = oSheet.Centermarks
For Each oDView As DrawingView In oSheet.DrawingViews
	
'----- Assign WPs to CMs for View1 -----	
	If 		oDView.Name.Contains("View1") Then
			oView1 = oDView
			
			oV1Cm1 = oCMs.AddByWorkFeature(oWP1, oView1) 	'KFI5
			oV1Cm2 = oCMs.AddByWorkFeature(oWP5, oView1) 	'KFI6

 

According to the Inventor api object model a detail drawingview is different from a drawingview

Daan_M_0-1597647481180.png

 

i tried doing this but without succes;

	
Dim oScm1, oScm2 As Centermark

			oScm1 = oCMs.AddByWorkFeature(oWP23, oDetailView) 
			oScm2 = oCMs.AddByWorkFeature(oWP24, oDetailView) 	

 

error; 

System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.Centermarks.AddByWorkFeature(Object WorkFeature, DrawingView DrawingView, Object CentermarkStyle, Object Layer)


at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

0 Likes
Message 4 of 4

ppolcynBNVFN
Enthusiast
Enthusiast

For  anyone trying to recreate this now, there is an error in line 12 that was preventing this code from working for me: "centre" should be "center"

0 Likes