.NET

Reply
Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 1 of 6 (359 Views)
Accepted Solution

Is it possible to draw without adding to DB - Jig Like ? (emulate a jig?)

359 Views, 5 Replies
03-17-2011 03:18 AM

I want to draw some lines but I want them disapear after a move or regen or something else, but not with jig. Something like emulating jig. Is that possible and how? Is it a trick with thse

 

 CurrentSpace.AppendEntity();
 Transaction.AddNewlyCreatedDBObject();
 Transaction.Commit();

 

or not?

 

Is it called  non-database-resident object? If so, how can I make it?

 

Something like parametrizing the draw method using parameters form - not from an Editor.drag() sampler.

 

I want to redraw an object based on form options and after making the desired options - draw it for real.

*Expert Elite*
norman.yuan
Posts: 961
Registered: ‎04-27-2009
Message 2 of 6 (338 Views)

Re: Is it possible to draw without adding to DB - Jig Like ? (emulate a jig?)

03-17-2011 07:00 AM in reply to: ognyandim

If you use Acad2009 or later, TransientGraphic would be what you need. I have a few articles with code sample on using TransientGraphic that may be of help to you.

 

http://drive-cad-with-code.blogspot.com/

 

Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 3 of 6 (284 Views)

Re: Is it possible to draw without adding to DB - Jig Like ? (emulate a jig?)

03-28-2011 02:11 AM in reply to: ognyandim

I will reply to myself in case someone else runs across this problem. I solved it that way :

1 ) Created a Form with which I pick all the settings needed for my custom object.

2 ) Created a class that contains my REDRAW() method that draws the object I want with dependence to the settings from the form

3 ) Created a structure with which I pass the settings from the Form to the class.

4 ) I make an instance of the form in the top left.

5 ) OnEvent (whatever event you want - radio button, numeric drop down, etc.) I get the data from the form and send it to the REDRAW() method in order to redraw my object with the new settings.

6 ) I keep all the drawable objects ( polylines, arcs, dimension lines, leaders, etc. ) in ObjectCollections, so I can delete them when I call REDRAW or modify them accordingly to the settings.

7 ) When the object satisfies me - I press OK and the object remains in the database.

8 ) If I press Cancel I use the object collection to remove the objects from the DB.

 

In other words -

1. make a form with which you gather your settings from the user,

2. make a class that instantiates the form and has a object collection to contain your custom object details (polys, arcs, lines etc)

3. and a dredraw() method in the class that accepts the settings (struct) and draws your object OnEvent (Any suitable event)

 

The visual effect is that my custom object gets redrawn every time I change a thing in my form and that form do not close, but sits still on the left leaving me to see my changes on the fly!

Its like transient graphics ( jig like ) with a form acting like a dynamic object - constructed and redrawn on every change in the form.

 

If somebody is interested and wants an example - I will make for him a simple one and will post it. For now I will not, because I don`t see interest on the topic.

Valued Mentor
stevenelliott3894
Posts: 474
Registered: ‎06-14-2010
Message 4 of 6 (272 Views)

Re: Is it possible to draw without adding to DB - Jig Like ? (emulate a jig?)

03-28-2011 05:41 AM in reply to: ognyandim

Ognyandim,

 

I would be interested in seeing the code you came up with. If it works the way I suspect it does from your description, I have an idea or two in which such a feature would come in handy.

 

So, I woud be grateful if you could share some of your code on this.

 

 

Thanks,

Steve

 

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!
Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 5 of 6 (265 Views)

Re: Is it possible to draw without adding to DB - Jig Like ? (emulate a jig?)

03-28-2011 07:55 AM in reply to: ognyandim

The example is in SHP.sample.zip. I have removed only the content of the draw method. This is a beta version of one of our functions. We make unfoldings of 2D and 3D sheet profiles. This is a sample from a sheet profile generator. Other functions work similiar to this.

Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 6 of 6 (254 Views)

Re: Is it possible to draw without adding to DB (emulate a jig?)

03-28-2011 10:28 AM in reply to: ognyandim

Here is a short movie of what the program actualy does. You can make whatever this way. We prefer making stuff this way, because dynamic blocks with lots of properties are too hard to make and consume much time to edit. We look for objects that have steps in the way they are constructed and then we automate them.


Here we have an example of Unfolding of a 3D or 2D sheet profile that has 3 steps - constructing it directly from poly (SHP.example) from poly, unfolding with bend decution or K-factor method (3D or 2D), and then we place a leader with different specs - paintable area in square meters, linear weight, etc.

 

http://www.mediafire.com/file/42sox4dm2g4szee/sheetGenerator.avi

 

Secondly we separete the input from the drawing process and using outside math library we can port our algorithm to other platforms - Rhino, Ares, AutoCAD, Zw, Gstar... whatever.

 

We have discovered that this is the best way that satisfies our need and ofcourse given our demands to modify classes, reuse parts of code, make similar interface for all our funx.


I suppose that this will be a good technique for other programmers and will save the day sometimes.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community