Como utilizar/habilitar o OSNAP em comandos criados através do VBNET.
Minhas ferramentas não funcionam com OSNAP/ESNAP.
O rastreamento polar também fica desabilitado.
O uso das teclas F10/F3 ou opções na barra de ferramentas não habilitam OSNAP/ESNAP, embora seja visível na barra de status que estão habilitados, na tela não selecionam.
Re: OSNAP / Rastreamento polar
#3Hi,
Not sure what you mean, but please refer this for turn ON/OFF OSNAP: viewtopic.php?f=3&t=1819&sid=fc6bcb1de2 ... 647ddcb76a
Not sure what you mean, but please refer this for turn ON/OFF OSNAP: viewtopic.php?f=3&t=1819&sid=fc6bcb1de2 ... 647ddcb76a
Re: OSNAP / Rastreamento polar
#4Sorry about that.QuanNguyen wrote: ↑Wed Dec 02, 2020 9:10 amHi,
Not sure what you mean, but please refer this for turn ON/OFF OSNAP: viewtopic.php?f=3&t=1819&sid=fc6bcb1de2 ... 647ddcb76a
I am trying to use OSNAP/Polar inside a VBNET command.
When I run the command, the OSNAP/ESNAp os objects does not is available.
OSNAP/ESNAP is available only in native commands.
Or, there is some variable to set when command begins ... or some SYSTEMVAR is missing inside command.
I tryied examples in package os CMS but nothing difrent or new ... I really believe I am missing somethig ...
Re: OSNAP / Rastreamento polar
#5PS.: I also tryied to set SYSTEMVAR("OSNAP") but it´s not usefull ... simply doens't select object snap in any option.DenisSilveira wrote: ↑Wed Dec 02, 2020 9:23 amSorry about that.QuanNguyen wrote: ↑Wed Dec 02, 2020 9:10 amHi,
Not sure what you mean, but please refer this for turn ON/OFF OSNAP: viewtopic.php?f=3&t=1819&sid=fc6bcb1de2 ... 647ddcb76a
I am trying to use OSNAP/Polar inside a VBNET command.
When I run the command, the OSNAP/ESNAp os objects does not is available.
OSNAP/ESNAP is available only in native commands.
Or, there is some variable to set when command begins ... or some SYSTEMVAR is missing inside command.
I tryied examples in package os CMS but nothing difrent or new ... I really believe I am missing somethig ...
Re: OSNAP / Rastreamento polar
#7This lines code is button inside a uc Form to click e run this code:
This lines code is for the classe above:
Code: Select all
Dim doc As Document = acApp.DocumentManager.MdiActiveDocument
Dim db As Teigha.DatabaseServices.Database = doc.Database
Dim ed As Editor = doc.Editor
Try
Using acLock As DocumentLock = doc.LockDocument()
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim P As New clsPerfiltabela(cbPerfil.SelectedValue)
Dim ltr As LayerTableRecord = CType(tr.GetObject(db.Clayer, teigha.DatabaseServices.OpenMode.ForRead), LayerTableRecord)
P.LayerMesa = LayMesa
P.LayerAlma = LayAlma
P.LayrCentro = LayCentro
P.offset = tbOffset.Text
Dim ppo As New PromptPointOptions("Ponto inicial>")
ppo.UseBasePoint = False
Dim ppr As PromptPointResult = ed.GetPoint(ppo)
If ppr.Status = PromptStatus.Cancel Then Exit Sub
Do
ppo = New PromptPointOptions("Próximo>")
ppo.UseBasePoint = True
ppo.BasePoint = ppr.Value
ppo.LimitsChecked = False
P.m_pt1 = ppr.Value
ppr = ed.GetPoint(ppo)
If Not ppr.Status = PromptStatus.Cancel Then
P.m_pt2 = ppr.Value
P.m_pto_base = P.m_pt1
P.DesenharPlanta()
End If
Loop Until ppr.Status = PromptStatus.Cancel
tr.Commit()
End Using
End Using
Catch ex As System.Exception
MsgBox(ex.Message, vbCritical)
Finally
End Try
Code: Select all
Public Sub DesenharPlanta()
Dim doc As IntelliCAD.ApplicationServices.Document = Core.Application.DocumentManager.MdiActiveDocument
Dim db As Teigha.DatabaseServices.Database = doc.Database
Dim ed As Editor = doc.Editor
Dim u As New Utilidade
Dim col As New List(Of ObjectId)
Dim colPerfil As New List(Of ObjectId)
''doc.Window.Focus()
'ObterPontos()
Try
Using acLock As DocumentLock = doc.LockDocument()
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim acBlkTbl As BlockTable = tr.GetObject(db.BlockTableId, Teigha.DatabaseServices.OpenMode.ForRead)
Dim acBlkTblRec As BlockTableRecord = tr.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), Teigha.DatabaseServices.OpenMode.ForWrite)
If Not IsNothing(m_pt1) AndAlso Not IsNothing(m_pt2) Then
Dim ptsMesa As New Point3dCollection
Dim ptsMesa2 As New Point3dCollection
Dim ptsAlma As New Point3dCollection
Dim ptsAlma2 As New Point3dCollection
Dim ptsHatch As New Point3dCollection
Dim ml As Mline = New Mline()
ml.SetDatabaseDefaults()
Dim PLinhaMesa As New Polyline
PLinhaMesa.SetDatabaseDefaults()
Dim PLinhaMesa2 As New Polyline
PLinhaMesa2.SetDatabaseDefaults()
Dim PLinhaAlma As New Polyline
PLinhaAlma.SetDatabaseDefaults()
Dim PLinhaAlma2 As New Polyline
PLinhaAlma2.SetDatabaseDefaults()
Dim PLinhaHatch As New Polyline
PLinhaHatch.SetDatabaseDefaults()
Dim LinhaDeCentro As Line = New Line(m_pt1, m_pt2)
LinhaDeCentro.SetDatabaseDefaults()
Dim acLineTypTbl As LinetypeTable
Dim sLineTypName As String
Select Case Tipo
#Region "trilho"
Case cTiposDePerfil.Trilho
CreateMLineStyleW(Descricao, bf, tw)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#Region "Redondos"
Case cTiposDePerfil.Redondos
#Region "Revisão 10/1/19"
CreateMLineStyleRedondos(Descricao, bf)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#Region "Antigo"
'Dim objId As ObjectId = utilidade.addLine(m_pt1, m_pt2)
'col.Add(objId)
''obter o angulo
'LinhaDeCentro = tr.GetObject(objId, teigha.DatabaseServices.OpenMode.ForRead)
'Dim Ang As Double = LinhaDeCentro.Angle
'Dim pt3 As Point3d = utilidade.GetPointAtDist(m_pt1, Math.PI * 3 / 2 + Ang, bf / 2)
'Dim pt4 As Point3d = utilidade.GetPointAtDist(m_pt2, Math.PI * 3 / 2 + Ang, bf / 2)
'ptsMesa.Add(pt3)
'ptsMesa.Add(pt4)
'pt3 = utilidade.GetPointAtDist(m_pt1, Math.PI / 2 + Ang, bf / 2)
'pt4 = utilidade.GetPointAtDist(m_pt2, Math.PI / 2 + Ang, bf / 2)
'ptsMesa.Add(pt4)
'ptsMesa.Add(pt3)
'ptsAlma2.Add(pt3)
'ptsAlma2.Add(pt4)
'acBlkTblRec.AppendEntity(PLinhaMesa)
'tr.AddNewlyCreatedDBObject(PLinhaMesa, True)
'Dim i As Integer = 0
'For Each pt As Point3d In ptsMesa
' PLinhaMesa.AddVertexAt(i, New Point2d(pt.X, pt.Y), 0, 0, 0)
' i += 1
'Next
'PLinhaMesa.Closed = True
'PLinhaMesa.Layer = LayerMesa
'col.Add(PLinhaMesa.ObjectId)
#End Region
#End Region
#Region "Chatos"
Case cTiposDePerfil.Chatos
#Region "Revisão 10/1/19"
CreateMLineStyleChatos(Descricao, bf)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#End Region
#Region "UDC duplo"
Case cTiposDePerfil.UDC_Duplo
#Region "Revisão 10/1/19"
CreateMLineStyleUDCDuplo(Descricao, bf, tw)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#End Region
#Region "CE Composto"
Case cTiposDePerfil.CE_COMPOSTO
Dim objId As ObjectId = Utilidade.addLine(m_pt1, m_pt2)
col.Add(objId)
colPerfil.Add(objId)
'obter o angulo
#Region "LADO ESQUERDO"
LinhaDeCentro = tr.GetObject(objId, Teigha.DatabaseServices.OpenMode.ForRead)
Dim Ang As Double = LinhaDeCentro.Angle
Dim pt3 As Point3d '= utilidade.GetPointAtDist(m_pt1, Math.PI / 2 + Ang, bf)
Dim pt4 As Point3d '= utilidade.GetPointAtDist(m_pt2, Math.PI / 2 + Ang, bf)
ptsMesa.Add(m_pt1)
ptsMesa.Add(m_pt2)
pt3 = Utilidade.GetPointAtDist(m_pt1, Math.PI / 2 + Ang, bf)
pt4 = Utilidade.GetPointAtDist(m_pt2, Math.PI / 2 + Ang, bf)
ptsMesa.Add(pt4)
ptsMesa.Add(pt3)
pt3 = Utilidade.GetPointAtDist(m_pt1, Math.PI / 2 + Ang, tw)
pt4 = Utilidade.GetPointAtDist(m_pt2, Math.PI / 2 + Ang, tw)
ptsAlma.Add(pt3)
ptsAlma.Add(pt4)
pt3 = Utilidade.GetPointAtDist(m_pt1, Math.PI / 2 + Ang, bf - tw)
pt4 = Utilidade.GetPointAtDist(m_pt2, Math.PI / 2 + Ang, bf - tw)
ptsAlma.Add(pt4)
ptsAlma.Add(pt3)
acBlkTblRec.AppendEntity(PLinhaMesa)
tr.AddNewlyCreatedDBObject(PLinhaMesa, True)
Dim i As Integer = 0
For Each pt As Point3d In ptsMesa
PLinhaMesa.AddVertexAt(i, New Point2d(pt.X, pt.Y), 0, 0, 0)
i += 1
Next
PLinhaMesa.Closed = True
PLinhaMesa.Layer = LayerMesa
col.Add(PLinhaMesa.ObjectId)
colPerfil.Add(PLinhaMesa.ObjectId)
acBlkTblRec.AppendEntity(PLinhaAlma)
tr.AddNewlyCreatedDBObject(PLinhaAlma, True)
i = 0
For Each pt As Point3d In ptsAlma
PLinhaAlma.AddVertexAt(i, New Point2d(pt.X, pt.Y), 0, 0, 0)
i += 1
Next
PLinhaAlma.Closed = True
PLinhaAlma.Layer = LayerAlma
col.Add(PLinhaAlma.ObjectId)
colPerfil.Add(PLinhaAlma.ObjectId)
#End Region
#Region "LADO DIREITO"
ptsMesa = New Point3dCollection
ptsMesa.Add(m_pt1)
ptsMesa.Add(m_pt2)
pt3 = Utilidade.GetPointAtDist(m_pt1, Math.PI * 3 / 2 + Ang, bf)
pt4 = Utilidade.GetPointAtDist(m_pt2, Math.PI * 3 / 2 + Ang, bf)
ptsMesa.Add(pt4)
ptsMesa.Add(pt3)
pt3 = Utilidade.GetPointAtDist(m_pt1, Math.PI * 3 / 2 + Ang, tw)
pt4 = Utilidade.GetPointAtDist(m_pt2, Math.PI * 3 / 2 + Ang, tw)
ptsAlma = New Point3dCollection
ptsAlma.Add(pt3)
ptsAlma.Add(pt4)
pt3 = Utilidade.GetPointAtDist(m_pt1, Math.PI * 3 / 2 + Ang, bf - tw)
pt4 = Utilidade.GetPointAtDist(m_pt2, Math.PI * 3 / 2 + Ang, bf - tw)
ptsAlma.Add(pt4)
ptsAlma.Add(pt3)
PLinhaMesa = New Polyline
PLinhaMesa.SetDatabaseDefaults()
acBlkTblRec.AppendEntity(PLinhaMesa)
tr.AddNewlyCreatedDBObject(PLinhaMesa, True)
i = 0
For Each pt As Point3d In ptsMesa
PLinhaMesa.AddVertexAt(i, New Point2d(pt.X, pt.Y), 0, 0, 0)
i += 1
Next
PLinhaMesa.Closed = True
PLinhaMesa.Layer = LayerMesa
col.Add(PLinhaMesa.ObjectId)
colPerfil.Add(PLinhaMesa.ObjectId)
PLinhaAlma = New Polyline
PLinhaAlma.SetDatabaseDefaults()
acBlkTblRec.AppendEntity(PLinhaAlma)
tr.AddNewlyCreatedDBObject(PLinhaAlma, True)
i = 0
For Each pt As Point3d In ptsAlma
PLinhaAlma.AddVertexAt(i, New Point2d(pt.X, pt.Y), 0, 0, 0)
i += 1
Next
PLinhaAlma.Closed = True
PLinhaAlma.Layer = LayerAlma
col.Add(PLinhaAlma.ObjectId)
#End Region
#End Region
#Region "CLaminado"
#End Region
#Region "UDC rigido, UE, Eu Duplo"
#End Region
#Region "UDC"
Case cTiposDePerfil.UDC, cTiposDePerfil.UDCRigido, cTiposDePerfil.UE, cTiposDePerfil.UE_duplo,
cTiposDePerfil.Chapeu, cTiposDePerfil.Z, cTiposDePerfil.Ze
#Region "Revisão 10/1/19"
CreateMLineStyleUDC_Planta(Descricao, bf, tf)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#End Region
#Region "Tubo Retangular"
Case cTiposDePerfil.TuboRetangular, cTiposDePerfil.TuboCircular, cTiposDePerfil.TuboQuadrado, cTiposDePerfil.TuboAL
#Region "Revisão 10/1/19"
CreateMLineStyleTubos(Descricao, bf, tf)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#End Region
#Region "Tubo Quadrado"
#End Region
#Region "Tubo Circular"
#End Region
#Region "Cantoneira"
Case cTiposDePerfil.Cantoneira, cTiposDePerfil.CantoneiraDesigual, cTiposDePerfil.CantoneiraAL, cTiposDePerfil.CantoneiraDupla
CreateMLineStyleCantoneira(Descricao, bf, tw)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
#Region "W, Cs, CVS, VS"
Case cTiposDePerfil.VigaW, cTiposDePerfil.VS, cTiposDePerfil.CVS, cTiposDePerfil.CS
#Region "Revisão 10/1/19"
CreateMLineStyleW(Descricao, bw, tw)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(m_pt1)
ml.AppendSegment(m_pt2)
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
colPerfil.Add(ml.ObjectId)
#End Region
'' Open the Linetype table for read
#End Region
#Region "Chapeu"
#End Region
#Region "Z"
Case cTiposDePerfil.Z
#End Region
#Region "Ze"
Case cTiposDePerfil.Ze
#End Region
Case cTiposDePerfil.Trelica
#Region "Treliça"
Dim idAux As Integer = IdBanzo
Dim Per As New clsPerfiltabela(idAux)
CreateMLineStyleCantoneira(Per.Descricao, Per.bf, Per.tw)
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
Dim LineSeg As New Line(m_pt2, m_pt1)
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt2, Math.PI / 2 + LineSeg.Angle, Espacador / 2 + Per.bf / 2))
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt1, Math.PI / 2 + LineSeg.Angle, Espacador / 2 + Per.bf / 2))
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
ml = New Mline
ml.Style = db.CmlstyleID
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt1, Math.PI / 2 * 3 + LineSeg.Angle, Espacador / 2 + Per.bf / 2))
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt2, Math.PI / 2 * 3 + LineSeg.Angle, Espacador / 2 + Per.bf / 2))
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
tr.TransactionManager.QueueForGraphicsFlush()
col.Add(ml.ObjectId)
#End Region
#Region "Joist"
Case cTiposDePerfil.Joist
Dim idAux As Integer = IdBanzo
Dim Banzo As New clsPerfiltabela(idAux)
Dim Diagonal As New clsPerfiltabela(IdDiagonal)
CreateMLineStyleCantoneira(Diagonal.Descricao, Diagonal.bf, Diagonal.tw)
Dim StyleDiagonal As ObjectId = db.CmlstyleID
CreateMLineStyleCantoneira(Banzo.Descricao, Banzo.bf, Banzo.tw)
Dim StyleBanzo As ObjectId = db.CmlstyleID
ml.Style = StyleBanzo
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
Dim LineSeg As New Line(m_pt1, m_pt2)
m_pt2 = New Point3d(m_pt1.X + LineSeg.Length, m_pt1.Y, m_pt1.Z)
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt1, Math.PI / 2 * 3, (Banzo.bf / 2 + Espacador / 2)))
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt2, Math.PI / 2 * 3, (Banzo.bf / 2 + Espacador / 2)))
Dim btr As BlockTableRecord = CType(tr.GetObject(db.CurrentSpaceId, Teigha.DatabaseServices.OpenMode.ForWrite), BlockTableRecord)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
Dim XP As New XPerfil
XP.Entity = ml
XP.ID = Banzo.Id
XP.Commit()
col.Add(ml.ObjectId)
ml = New Mline
ml.Style = StyleBanzo
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt2, Math.PI / 2, (Banzo.bf / 2 + Espacador / 2)))
ml.AppendSegment(Utilidade.GetPointAtDist(m_pt1, Math.PI / 2, (Banzo.bf / 2 + Espacador / 2)))
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
XP = New XPerfil
XP.Entity = ml
XP.ID = Banzo.Id
XP.Commit()
col.Add(ml.ObjectId)
Dim pt1 As New Point3d(m_pt1.X + Banzo.bf / 2, m_pt1.Y - (Banzo.bf + Espacador / 2), m_pt1.Z)
Dim pt2 As New Point3d(m_pt1.X + (Banzo.bf + Espacador) + Banzo.bf / 2, m_pt1.Y + (Banzo.bf + Espacador / 2), m_pt1.Z)
Dim contador As Integer = Math.Floor(LineSeg.Length / (Banzo.bf + Espacador))
For i As Integer = 1 To contador
ml = New Mline
ml.Style = StyleDiagonal
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
LineSeg = New Line(pt1, pt2)
ml.AppendSegment(Utilidade.GetPointAtDist(pt2, LineSeg.Angle + Math.PI, Banzo.bf * 2 ^ 0.5))
ml.AppendSegment(Utilidade.GetPointAtDist(pt1, LineSeg.Angle, Banzo.bf * 2 ^ 0.5))
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
XP = New XPerfil
XP.Entity = ml
XP.ID = Diagonal.Id
XP.Commit()
col.Add(ml.ObjectId)
ml = New Mline
ml.Style = StyleDiagonal
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
LineSeg = New Line(pt1, pt2)
ml.AppendSegment(New Point3d(pt1.X, pt2.Y, pt1.Z))
ml.AppendSegment(pt1)
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
XP = New XPerfil
XP.Entity = ml
XP.ID = Diagonal.Id
XP.Commit()
col.Add(ml.ObjectId)
pt1 = New Point3d(pt1.X + (Banzo.bf + Espacador), pt1.Y, pt1.Z)
pt2 = New Point3d(pt2.X + (Banzo.bf + Espacador), pt2.Y, pt2.Z)
Next
' última diagonal e montante
pt2 = New Point3d(m_pt2.X, pt2.Y, pt2.Z)
'diagonal
ml = New Mline
ml.Style = StyleDiagonal
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
LineSeg = New Line(pt1, pt2)
ml.AppendSegment(Utilidade.GetPointAtDist(pt1, LineSeg.Angle, Banzo.bf * 2 ^ 0.5))
ml.AppendSegment(Utilidade.GetPointAtDist(pt2, LineSeg.Angle + Math.PI, Banzo.bf * 2 ^ 0.5))
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
XP = New XPerfil
XP.Entity = ml
XP.ID = Diagonal.Id
XP.Commit()
col.Add(ml.ObjectId)
' montante
ml = New Mline
ml.Style = StyleDiagonal
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
LineSeg = New Line(pt1, New Point3d(pt1.X, pt2.Y, pt2.Z))
ml.AppendSegment(pt1)
ml.AppendSegment(New Point3d(pt1.X, pt2.Y, pt1.Z))
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
XP = New XPerfil
XP.Entity = ml
XP.ID = Diagonal.Id
XP.Commit()
col.Add(ml.ObjectId)
'montante final
ml = New Mline
ml.Style = StyleDiagonal
ml.Normal = Vector3d.ZAxis
ml.Justification = MlineJustification.Zero
LineSeg = New Line(pt1, pt2)
ml.AppendSegment(New Point3d(pt2.X - Banzo.bf / 2, pt1.Y, pt1.Z))
ml.AppendSegment(New Point3d(pt2.X - Banzo.bf / 2, pt2.Y, pt2.Z))
btr.AppendEntity(ml)
tr.AddNewlyCreatedDBObject(ml, True)
XP = New XPerfil
XP.Entity = ml
XP.ID = Diagonal.Id
XP.Commit()
col.Add(ml.ObjectId)
#End Region
End Select
sLineTypName = Linhas.Center
acLineTypTbl = tr.GetObject(IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.LinetypeTableId,
Teigha.DatabaseServices.OpenMode.ForRead)
Dim LineTypesPath As String = IntelliCAD.ApplicationServices.Application.GetSystemVariable("LINETYPESPATH")
Dim path As String = String.Format("{0}\{1}", LineTypesPath, "Icad.lin")
If acLineTypTbl.Has(sLineTypName) = False Then
'' Load the Center Linetype
IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.LoadLineTypeFile(sLineTypName, path)
End If
sLineTypName = Linhas.Dashed
#Region "xdata"
Utilidade.AddRegAppTableRecord(Aplicativos.Grelha.Perfil)
Dim rb As New ResultBuffer
Dim rb2 As ResultBuffer = New ResultBuffer
rb2.Add(New TypedValue(DxfCode.ExtendedDataAsciiString, vId.ToString(New CultureInfo("pt-br"))))
rb.Add(New TypedValue(DxfCode.ExtendedDataRegAppName, Aplicativos.Grelha.Perfil))
rb.Add(New TypedValue(DxfCode.ExtendedDataAsciiString, vId.ToString(New CultureInfo("pt-br"))))
ml.XData = rb
#End Region
#Region "HATCH"
#End Region
Colect = New ObjectIdCollection
For Each c As ObjectId In colPerfil
Colect.Add(c)
Dim XP As New XPerfil
XP.Entity = c.GetObject(Teigha.DatabaseServices.OpenMode.ForWrite)
XP.ID = vId
XP.Commit()
Dim XV As New XVista
XV.Entity = XP.Entity
XV.Vista = Vistas.Planta
XV.commit()
Next
Dim baseWcs As Point3d = m_pto_base.TransformBy(ed.CurrentUserCoordinateSystem)
Dim jigger As New AcadNetAddinCS.MoveRotationScaleJig(m_pto_base)
If isJigger Then
For Each id As ObjectId In col
Dim ent As Entity = DirectCast(tr.GetObject(id, Teigha.DatabaseServices.OpenMode.ForWrite), Entity)
ent.XData = Xdata()
jigger.AddEntity(ent)
Next
If jigger.Jig() Then
jigger.TransformEntities()
End If
End If
m_angle = LinhaDeCentro.Angle
ptsMesa.Dispose()
ptsMesa2.Dispose()
ptsAlma.Dispose()
ptsAlma2.Dispose()
ptsHatch.Dispose()
End If
tr.Commit()
End Using
End Using
Catch ex As System.Exception
MsgBox(String.Format("Erro: {0} {1} {2}", ex.Message, ex.Source, ex.StackTrace), MsgBoxStyle.Critical, "Erro de seleção de vigas")
Finally
End Try
End Sub
Re: OSNAP / Rastreamento polar
#8Even when we run a simple line draw with two editor.getpoint() we cannot select snap grips.
Objects snaps is not available to select when Editor.Getpoint is called.
In other hand, using BasePoint in PromptPointOption second call, after we had first call, the rubber line is not attached to the right point (the last beeing selected).
It´s quietly complicated to explain, but in INTELLICAD CMS 10 does not occur, but in ICMS 9 occurs.
ok.
Objects snaps is not available to select when Editor.Getpoint is called.
In other hand, using BasePoint in PromptPointOption second call, after we had first call, the rubber line is not attached to the right point (the last beeing selected).
It´s quietly complicated to explain, but in INTELLICAD CMS 10 does not occur, but in ICMS 9 occurs.
ok.
Re: OSNAP / Rastreamento polar
#9Please refer to this simple code, the OSNAP/ORTHO work as it is.
Code: Select all
<CommandMethod("lineVBNet")>
Public Sub lineVBNet()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Try
Using acLock As DocumentLock = doc.LockDocument()
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = CType(tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btr As BlockTableRecord = CType(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
Dim startPt As Point3d
Dim endPt As Point3d
Dim ppo As New PromptPointOptions("Start point>")
ppo.UseBasePoint = False
Dim ppr As PromptPointResult = ed.GetPoint(ppo)
If ppr.Status = PromptStatus.Cancel Then Exit Sub
startPt = ppr.Value
Do
ppo = New PromptPointOptions("Next point>")
ppo.UseBasePoint = True
ppo.BasePoint = startPt
ppo.LimitsChecked = False
ppr = ed.GetPoint(ppo)
If Not ppr.Status = PromptStatus.Cancel Then
endPt = ppr.Value
Dim line As Line = New Line(startPt, endPt)
btr.AppendEntity(line)
tr.AddNewlyCreatedDBObject(line, True)
'line.RecordGraphicsModified(True)
ed.Regen()
startPt = endPt
End If
Loop Until ppr.Status = PromptStatus.Cancel
tr.Commit()
End Using
End Using
Catch ex As System.Exception
MsgBox(ex.Message, vbCritical)
Finally
End Try
End Sub
Re: OSNAP / Rastreamento polar
#10Simply doesn't work.
see my Drawing Settings - snap
see my Drawing Settings - snap
- Attachments
-
- snap1.jpg (70.71 KiB) Viewed 8141 times
Re: OSNAP / Rastreamento polar
#11I am desperate.
All of my commands in Acad is not working properly because depends of snap many times.
I bellieve there is some missing config anyway ...
May I need to explain that native commands like "line" (for simple) shows the grips for snaps defined in my config.
But commands called inside my linecodes doesn't. This makes me believ there is something ocurring during the interval time to call command and code to run, because object in window seems to be invisible.
All of my commands in Acad is not working properly because depends of snap many times.
I bellieve there is some missing config anyway ...
May I need to explain that native commands like "line" (for simple) shows the grips for snaps defined in my config.
But commands called inside my linecodes doesn't. This makes me believ there is something ocurring during the interval time to call command and code to run, because object in window seems to be invisible.
Re: OSNAP / Rastreamento polar
#12Just In time.
I tested your linecodes inside completly new app and works !!!
I need to find where is the bug ...
I tested your linecodes inside completly new app and works !!!
I need to find where is the bug ...
Re: OSNAP / Rastreamento polar
#14I had tryied many options. I descovered that calling <CommandMethod> directly is usefull.
When I call lineVbNet by form button or form menu the snaps is not working.
Calling CommandMethod goes directly to the window.
Calling by button or menu I need a first click to select the window and it's not also snaps working.
Keep going ... any sugestions are welcome.
When I call lineVbNet by form button or form menu the snaps is not working.
Calling CommandMethod goes directly to the window.
Calling by button or menu I need a first click to select the window and it's not also snaps working.
Keep going ... any sugestions are welcome.
Re: OSNAP / Rastreamento polar
#15Code: Select all
<CommandMethod("lineVBNet")>
Public Sub lineVBNet()
Dim doc As IntelliCAD.ApplicationServices.Document = IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Try
...
Code: Select all
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
lineVBNet()
End sub