CAD/CAM discussion forum > CAD Tutorial & Tips > ZW CAD vb.net sample code: edit scale entity

ZW CAD vb.net sample code: edit scale entity

Rank: 5Rank: 5

Viola

posts: 10

Registered: 2013-7-12

Message 1 of 1

 ZW CAD vb.net sample code: edit scale entity
30-07-2013 04:36 . pm | View his/her posts only
ZWCAD+ vb.net sample code: edit scale entity.
vb.net sample codes:

Imports ZwSoft.ZwCAD.Runtime
Imports ZwSoft.ZwCAD.ApplicationServices
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.Geometry

Public Class ZwcadApps

_
Public Sub ScaleObject()
Dim ZcDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZcDB As Database = ZcDoc.Database
Dim ZcEd As Editor = ZcDoc.Editor

Using ZcTran As Transaction = ZcDB.TransactionManager.StartTransaction()

Dim peo As New PromptEntityOptions(vbLf & "Select object:")
Dim per As PromptEntityResult = ZcEd.GetEntity(peo)
If per.Status <> PromptStatus.OK Then
Return
End If
Dim Ent As Entity = ZcTran.GetObject(per.ObjectId, OpenMode.ForWrite)

Dim pro1 As New PromptPointOptions(vbLf & "Input base point:")
Dim proR1 As PromptPointResult = ZcEd.GetPoint(pro1)
If proR1.Status <> PromptStatus.OK Then
Return
End If
Dim basePt As Point3d = proR1.Value

Dim pro2 As New PromptDoubleOptions(vbLf & "Specify scale factor:")
Dim proR2 As PromptDoubleResult = ZcEd.GetDouble(pro2)
If proR2.Status <> PromptStatus.OK Then
Return
End If
Dim scf As Double = proR2.Value

Dim Mt As Matrix3d = Matrix3d.Scaling(scf, basePt)
Ent.TransformBy(Mt)

ZcTran.Commit()
End Using
End Sub

End Class





Try ZWCAD+ free for 30 days:
http://www.zwsoft.com/zwcad+/
See also