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
(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...
Solved! Go to Solution.
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
tanks.
here the solution for this.
Tnaks to him. Best trick this _RO 😛
Can't find what you're looking for? Ask the community or share your knowledge.