Code Red > .NET

Hatch not showing up after creation

<< < (6/6)

Kralj_klokan:
Hi everyone,

The conclusion is that code posted is working fine. When I type the command in the command prompt its working perfectly. As i wished to call the command from a button on a palette i found out that it has to be something that has to do with the palette.
I even tried calling the same code from a modal dialog or simply immediately when initializing the application and everything worked.

The only explanation must that when calling this kind of code from a palette results in errors and is not reliable.
If anyone tries to do the same thing i did i can only suggest that he tries using a modal dialog while creating his plugin since it seems that it's more reliable.

Thanks everyone for your help.

kdub_nz:

Show us the code you are using from the button callback/event please.

Kralj_klokan:

--- Quote from: kdub on July 20, 2019, 08:57:03 PM ---
Show us the code you are using from the button callback/event please.

--- End quote ---
This is the way i show my tool palette (WPF):


--- Code - C#: ---            var palette = new ToolPaletteViewModel();            palette.AddVisual("", new ToolPaletteView() { DataContext = palette });            palette.Visible = true;            palette.Dock = DockSides.Right; 
This is my xaml for the button:

--- Code - XML: ---<Button Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.ItemSelectedCommand}" CommandParameter="{Binding}" Margin="5"/>
And when the button is pressed the code is:


--- Code - C#: ---        internal void StartHatchingByPickPoint(string layerName, Autodesk.AutoCAD.Colors.Color color)        {            var hatch = new PickPointHatch(layerName, color);            PickPointHatch.TraceBoundaryAndHatch();        } 
If I call the last bit of code i posted anywhere but on the toolpalette it will work. Ridicolous.

Some more info:

If i put the loop to be appended as outermost, the hatch is being displayed but without the islands. If i click on the hatch editor i see that the hatchstyle is set to outer. But toggling from normal to outer does nothing . The hatch stays the same.
If i click on the outer polyline twice and then press Cancel the hatch will display the right way and the islands show. Also, moving the hatch a little will also work. As if autocad recalculates the hatch if i move/edit the associated borders.

Navigation

[0] Message Index

[*] Previous page

Go to full version