.NET

Reply
Valued Mentor
AubelecBE
Posts: 372
Registered: ‎01-27-2010
Message 1 of 3 (294 Views)
Accepted Solution

using Jig in Jig

294 Views, 2 Replies
08-30-2012 05:50 AM

Here the main prog : (calling thr main jig)

Public Shared Sub JigDBText()

Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Dim pso As PromptStringOptions = New PromptStringOptions(vbCrLf & "Entrez votre texte : ")
pso.AllowSpaces = True
Dim pr As PromptResult = ed.GetString(pso)

If pr.Status <> PromptStatus.OK Then Exit Sub
Dim tr As Transaction = doc.TransactionManager.StartTransaction()
Using tr
Dim btr As BlockTableRecord = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)
'Create the text object, set its normal and contents
Dim txt As DBText = New DBText()
txt.Normal = ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis
txt.TextString = pr.StringResult
'// We'll add the text to the database before jigging
'// it - this allows alignment adjustments to be
'// reflected

btr.AppendEntity(txt)
tr.AddNewlyCreatedDBObject(txt, True)
'// Create our jig
Dim pj As JigDBText = New JigDBText(tr, db, txt)
'// Loop as we run our jig, as we may have keywords
Dim stat As PromptStatus = PromptStatus.Keyword
While (stat = PromptStatus.Keyword)
Dim res As PromptResult = ed.Drag(pj)
stat = res.Status
If (stat <> PromptStatus.OK And stat <> PromptStatus.Keyword) Then
Return
End If
End While
tr.Commit()
End Using
End Sub

 here the sampler fonction of the main jig :

   Protected Overrides Function Sampler(ByVal jp As Autodesk.AutoCAD.EditorInput.JigPrompts) As Autodesk.AutoCAD.EditorInput.SamplerStatus
'// We acquire a point but with keywords

Dim po As Autodesk.AutoCAD.EditorInput.JigPromptPointOptions = _
New JigPromptPointOptions("\nPosition du texte")

po.UserInputControls = _
(UserInputControls.Accept3dCoordinates & _
UserInputControls.NullResponseAccepted & _
UserInputControls.NoNegativeResponseAccepted & _
UserInputControls.GovernedByOrthoMode)

po.SetMessageAndKeywords( _
"\nSpecify position of text or " & _
"[GRas/Italic/+GRos/+Petit/" & _
"Rotation/Gauche/Milieu/Droite/Haut/Centre/Bas/HG/HC/HD/MG/MC/MD/BG/BC/BD]: ",
"GRas Italic +GRos +Petit " & _
"Rotation Gauche Milieu Droite " & _
"Haut Centre Bas HG HC HD MG MC MD BG BC BD")

Dim ppr As PromptPointResult = jp.AcquirePoint(po)

If (ppr.Status = PromptStatus.Keyword) Then

Select Case ppr.StringResult

Case "Rotation"

Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor

Dim db As Database = doc.Database

Dim txt As DBText = Entity

'// Create our jig object
Dim jig As JigRotation = New JigRotation(db, _
txt, _
_position, _alignH, _alignV, _
"Angle :")
Dim res As PromptResult = ed.Drag(jig)
If (res.Status = PromptStatus.OK) Then


'// Get the overall rotation angle

_angle = jig.GetRotation()

End If
jig = Nothing

End Select

Return SamplerStatus.OK
ElseIf (ppr.Status = PromptStatus.OK) Then

'// Check if it has changed or not (reduces flicker)
If (_position.DistanceTo(ppr.Value) < Tolerance.Global.EqualPoint) Then
Return SamplerStatus.NoChange
End If


_position = ppr.Value
Return SamplerStatus.OK
End If

Return SamplerStatus.Cancel
End Function

 

the main jig is ok if i dont use the keyword Rotation

the sub Jig for rotation work fine but i dont validate the main jig after validate the sub jig...

 

so could you help me ?

 

The source code for the main jig is from

http://through-the-interface.typepad.com/through_the_interface/2012/08/a-handy-jig-for-creating-auto...

(Thank to him)

and the sub jig is from : http://forums.autodesk.com/t5/NET/How-to-jig-rotate-a-block-with-different-fixed-point/m-p/3458190/h...

(chiefbraincloud)

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 2 of 3 (235 Views)

Re: using Jig in Jig

09-07-2012 08:36 AM in reply to: AubelecBE

You can't embed Jigs unfortunately.

 

What you need to do is record a mode inside of your Jig... If the Rotation is executed, set your mode to Rotation and then in your update function test the mode and if set to rotation, then update the rotation value.

 

Basically, a single Jig must contain all of your manipulation types





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Valued Mentor
AubelecBE
Posts: 372
Registered: ‎01-27-2010
Message 3 of 3 (203 Views)

Re: using Jig in Jig

09-09-2012 08:26 AM in reply to: AubelecBE

tanks.

 

here the solution for this.

 

http://through-the-interface.typepad.com/through_the_interface/2012/09/a-handy-jig-for-creating-auto...

 

 

Tnaks to him. Best trick this _RO :smileytongue:

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community