.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert block with preview.

10 REPLIES 10
Reply
Message 1 of 11
Ertqwa
2118 Views, 10 Replies

Insert block with preview.

Hello Forum,

 

I insert a block with Database.Insert(). I get the insertion point with Editor.GetPoint().

 

What I would like is to see a 'preview' of the block that is to be inserted, while selecting the insertion point, similar as AutoCAD's INSERT command. Is that possible and how?

 

I could not find an answer to the question, but that may be because I don't know how such a 'preview' would be called.

 

Thank you.

 

 

10 REPLIES 10
Message 2 of 11
Alfred.NESWADBA
in reply to: Ertqwa

Hi,

 

yes, it is possible.

The perfect method would be to use the way of JIG's (take a look >>>here<<<), of course this will need a lot of coding.

 

The minimalistic method would be to insert the block at 0,0,0, end your routine by initiating a SendCommand with _MOVE, select the previous inserted blockreference, set basepoint (for move) to 0,0,0 and then just stop ==> now the user has the block at his curser for draging. Well, this depends also on your workflow.

 

- alfred -

 

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 11
Ertqwa
in reply to: Alfred.NESWADBA

Helo,

 

I was hoping for a way without SendCommand.

 

I've seen the word JIG a few times already, but don't know what it is. I will look into it and check out your link.

 

Thanks for the response!

Message 4 of 11
GTVic
in reply to: Ertqwa

If you have access to AU (Search Results)

 

There was a class in 2008 called CP305-2 that I think has everything you would need including sample code.

Message 5 of 11
ognyandim
in reply to: Ertqwa

Do you want to preview the block before insertion or you want to see it like a jig during insertion?

 

From what you have written I understand that you want to see a preivew like in INSERT command.

In order to see that you need a class for thumbnail preview and a form in which to display the preview.

Look at the acThumbnailReader.zip. I use this class for the same tool you want - A database with blocks displayed in a listbox with a search filter and a picture box for preview.

 

Message 6 of 11
Ertqwa
in reply to: GTVic

Hi, I'm afraid I do not have access.

 

Thank you for the response tho.

Message 7 of 11
Ertqwa
in reply to: ognyandim

No, I have the preview of the block inside a control (listview icon / picture box).

 

I want to see it during insertion.

 

Off topic:

We use Schueco a lot :D.

 

Thank you for the response.

Message 8 of 11
BillZndl
in reply to: Ertqwa

AcThumnailReader si the way to go to display in a picture box.

 

if

(!string.IsNullOrEmpty(FlNam) && System.IO.File.Exists(FlNam))

{

pictureBox2.Image =

null;

System.Drawing.

Image dwgImg = acThumbnailReader.GetThumbnail(FlNam, false);

pictureBox2.Image = dwgImg;

pictureBox2.Update();

}

 

For the copy, move, insert dragging, I used the code found here:

http://through-the-interface.typepad.com/through_the_interface/2011/03/using-transient-graphics-to-s...

 

 

Message 9 of 11
ognyandim
in reply to: Ertqwa

If they are not dynamic the most you will get is importing the block like drag and drop drom folder. Is that what you want to achieve? Be more specific and put the context and do not save your words, because I am guessing what you want to do.

 

If you provide explanation of what you want I will be able to help. A screenshot or a picture will be useful. I am saying that because you started with preview, but now I think that it is maybe a Jig. But a jig is useless when using static blocks like these from SCHUCO catalouge - we are using SHUCO catalogue for facade bulding here and we are inserting the blocks programatically the way the INSERT ( like insert ) command does.

 

 

 

 

Message 10 of 11
Ertqwa
in reply to: ognyandim

Ok, I'll rephrase.

 

I have code to insert a block (the user selects a block from a listview, then clicks on a button to pick the insertion point. Then the block is inserted at that point). While the user is picking the insertion point, I want to see a transparent image of the block at the cursor, similar as AutoCAD's INSERT command.

 

I will check out the suggestions made in this post. Thank you.

 

 

Message 11 of 11
ognyandim
in reply to: Ertqwa

1. Create a form with picture box and

2. a list box

3. populate the list box

4. OnClick on top of list box item use the thumbnail preview class that I have already provided in my previous post to show a preview of the dwg.

5. OnDoubleClick ( or button click ) on selection of list item close the form and use the selected parameters to import the DWG.

6. You can use the WorldDraw method to draw the block without inserting it in the drawing.

 

Your program has three major parts

1. Form with list box and picture box

2. A method that can copy objects between two DWGs without opening them.

3. A command method that will start the form and recieve the params for the block from it ( block name or dwg file name if you like ), promt the user for insertion point  and then call the func in point 2 with the correct parameters in order to put the drawing.

 

I am not pasting the code here even I have absolutley the same program, because I dont want to do your homework. I am sure it will be interesting for you to do it yourself.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost