Author Topic: Import text style, dim style, leader style drop down list from Autocad  (Read 5641 times)

0 Members and 1 Guest are viewing this topic.

latour_g

  • Newt
  • Posts: 184
Hi,

I would like to know if there is a way to import the drop down list from the style toolbar in my tool palette ? I would like to incorporate them in my tool palette without doing it from scratch.
Is it doable ? I try to google that but I can't find my answer.

Thank you
« Last Edit: April 27, 2016, 03:06:18 PM by latour_g »

lamarn

  • Swamp Rat
  • Posts: 636
Maybe You should take a look at Lee Mac Steal from drawing/ template command..
Design is something you should do with both hands. My 2d hand , my 3d hand ..

latour_g

  • Newt
  • Posts: 184
I looked at it but it's not what I'm looking for.  Here is another pic, I want to put Autocad list in my tool palette.

ChrisCarlson

  • Guest
Do you just want to list the available (within the current dwg) or something else?

Code - C#: [Select]
  1. textStyleTable = (TextStyleTable)tr.GetObject(db.TextStyleTableId, OpenMode.ForRead);

latour_g

  • Newt
  • Posts: 184
Yes but I don't want to validate the list when the user change drawing or add/remove style.   So I thought if I took the list from Autocad it would always be up to date.
But maybe it's not doable !

MexicanCustard

  • Swamp Rat
  • Posts: 705
Look at Application.UIBindings.Collections.  You didn't mention the architecture you're using to create the palette.  If you're using WPF you can bind directly to the collections.
Revit 2019, AMEP 2019 64bit Win 10

ChrisCarlson

  • Guest
Potentially?

Code - C#: [Select]
  1. TextStyles = Application.UIBindings.Collections.TextStyles;

Code - Text: [Select]
  1. <ComboBox ItemsSource="{Binding TextStyles}">

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
How did you get your tool palette to look like that? That's cool. Mine are just basic icon with text next to them.
Civil3D 2020

ChrisCarlson

  • Guest
How did you get your tool palette to look like that? That's cool. Mine are just basic icon with text next to them.

Custom .NET palette.

latour_g

  • Newt
  • Posts: 184
Thanks this is what I need.  I tried to apply it to my code but I didn't suceed yet, I'm trying to figure out what's wrong.

Code - C++: [Select]
  1. Autodesk.AutoCAD.Windows.Data.DataItemCollection ts = AcadApp.UIBindings.Collections.TextStyles;
  2. var bs = new BindingSource(ts, null);
  3. this.cbTest.DataSource = bs;
  4.  
  5.  

Here is the content of the combobox with this code :

ChrisCarlson

  • Guest

latour_g

  • Newt
  • Posts: 184
Re: Import text style, dim style, leader style drop down list from Autocad
« Reply #11 on: April 29, 2016, 09:20:58 AM »
No ! I have never use WPF.  Thanks for the link, I'm looking at it right now.

latour_g

  • Newt
  • Posts: 184
I've been working on this WPF things and I can't make it work correctly.

Here is what I've done so far.

1 - I have create a new user control (WPF) named listeAutocad.xaml
2 - I have declare Textstyle + binding it to my combobox (see image)
3 - I have create a Element host in my pallette but I get an error when trying to choose listeAutocad (see image)

MexicanCustard

  • Swamp Rat
  • Posts: 705
You're binding the ItemsSource to TextStyles.  Where are you defining TextStyles? 
Revit 2019, AMEP 2019 64bit Win 10

MexicanCustard

  • Swamp Rat
  • Posts: 705
Also, if you're just learning WPF I would recommend starting out with the MVVM architecture.  Easier to learn it first then to unlearn code behind and start using MVVM later.
Revit 2019, AMEP 2019 64bit Win 10