Valued Mentor
411 Posts
29 Kudos
Registered: ‎01-27-2010
Post 1 of 3
Accepted Solution

using Jig in Jig

322 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

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
End If
End While
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 & _

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


(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...


ADN Support Specialist
352 Posts
27 Kudos
Registered: ‎07-24-2007
Post 2 of 3

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
411 Posts
29 Kudos
Registered: ‎01-27-2010
Post 3 of 3

Re: using Jig in Jig

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



here the solution for this.





Tnaks to him. Best trick this _RO :smileytongue:



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!