Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm try to used PickPoint method in winform.
When the PreviewControl is not in the winform, it's run well!
But, the PreviewControl is in the winform... It's not working...
class TestEventHandler(IExternalEventHandler):
def Execute(self, aa):
try:
# All the SnapTypes
snapTypes = ObjectSnapTypes.Endpoints | ObjectSnapTypes.Midpoints | ObjectSnapTypes.WorkPlaneGrid | ObjectSnapTypes.Intersections | ObjectSnapTypes.Centers | ObjectSnapTypes.Perpendicular | ObjectSnapTypes.Points
PickPoint(snapTypes, "Pick Point")
except Exception as e:
print(e)
def GetName(self):
return "TestEventHandler"
test_event_handler = TestEventHandler()
ext_event = ExternalEvent.Create(test_event_handler)
class Test_Gui(Form):
def __init__(self):
self.btn_pickPoint = Button(Text = "Pick Point")
self.btn_pickPoint.Location = Point(25, 5 +obj_hight)
self.btn_pickPoint.Width = 100
self.btn_pickPoint.Height = 50
self.btn_pickPoint.Click += self.pick_pt
currentViewId = uidoc_view.Id
preview = PreviewControl(doc, currentViewId)
elementHost = Integration.ElementHost()
elementHost.Location = Point(0,0)
elementHost.Dock = DockStyle.None
elementHost.Size = Size(1100, 510)
elementHost.TabIndex = 0
elementHost.Parent = self
elementHost.Child = preview
elementHost.Location = Point(25, 5.4)
self.Controls.Add(self.btn_pickPoint)
self.Controls.Add(elementHost)
self.Width = 1200
self.Height = 980
def pick_pt(self, sender, e):
test = ext_event.Raise()
def main():
try:
#Test_Gui().Show()
Application.Run(Test_Gui())
except Exception as ex:
print(ex)
▲The above code is part of the code.
Please help me...
Solved! Go to Solution.