|
You'd be better off looking at the company's site to see if you can tie into their .dlls/apis.
Some links I found from Google:
http://www.solidworks.com/sw/support/1835_ENU_HTML.htm
http://www.cadsolutions.ca/magazine/api.asp
http://lmgtfy.com/?q=solidworks+api
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi,
I'm currently working on a 2D game engine for my RPG. Now the work on the physics engine is almost done, but the graphics are seems to be the biggest problem. I'm using VB 2008 and for the graphics - GDI+ . Almost all of the objects in my game are *png images, with smooth shadows and so on... I'm drawing the objects using two methods: the first one sets the drawing priority so that no one player can step on the head of other players. The second one is the loop that draws all the objects(players and textures) on the playground, that loop uses the GDI+ Graphics.DrawImage function and all this code looks like this:
'this subroutine sets the draw priority:
Sub SetObjDrawPriority()
For i = 0 To UBound(HBD)
Select Case HBD(i).booIsAlive
Case True
intDrawPriority(i) = HBD(i).intTop
End Select
Next
Array.Sort(intDrawPriority)
End Sub
Sub DrawAllObjects(ByVal e As System.Windows.Forms.PaintEventArgs)
Try
SetObjDrawPriority()
For i = 0 To UBound(HBD)
For i2 = 0 To UBound(HBD)
If HBD(i2).intTop = intDrawPriority(i) Then
e.Graphics.DrawImage(HBD(i2).bmpFace, HBD(i2).intLeft, _
HBD(i2).intDrawTop, HBD(i2).intWidth, HBD(i2).intObjDrawHeight)
End If
Next
Next
Catch ex As Exception
End Try
End Sub
If I use *bmp texture for the objects with this size: 51 x 86 I can move simultaneously more than 200 objects on the visible area of the screen which is great, but If I replace the *bmp with *png images(with the same size: 51 x 86) the performance goes so bad that I can move normally less than 40 objects! Please tell me whats wrong. Is there any problem with the GDI+? I heard that GDI+ is wery slow and most of the programmers avoid it. I think that the code is pretty simple, but anyway maybe I'm wrong, please tell me how to optimize the code in case to get better performance.
Thank you.
|
|
|
|
|
Maybe because png pic´s are compressed?
|
|
|
|
|
PNG's are compressed images. They have to be uncompressed to draw them. If you're requiring that kind of performance, look into the XNA Framework.
|
|
|
|
|
I've never heard before that PNG is compressed is there an uncompressed PNG format?
I'm currently learning C++ but I'm only on the beginning so I can't move that fast to XNA, cause as I know XNA requires C++ or C#.
|
|
|
|
|
O.G.I. wrote: I'm currently learning C++ but I'm only on the beginning so I can't move that fast to XNA, cause as I know XNA requires C++ or C#.
Nothing like trial by fire right? You could always give a try and post questions when you get stuck.
Ping compression details
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi,
I don't see where the image's fileformat would be relevant, assuming you load the images into memory once (hence outside your drawing methods), which turns them into uncompressed bitmaps anyway, e.g. using Bitmap bm=Bitmap.FromFile(filepath); or something similar with FromSream. (example is C# syntax!).
PS: I strongly object to your code swallowing exceptions; if you (think you) need a try-catch, then do something useful with the exception, e.g. display it's Exception.ToString().
[ADDED]And if there is a very specific exception that you rightfully want to ignore, add a catch for that specific exception and insert a comment as to why it is OK to ignore it; then leave the more general catch out, or put some code in it.
[/ADDED]
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
modified on Thursday, June 25, 2009 10:44 AM
|
|
|
|
|
how can i fire a form through tree view node click event.
|
|
|
|
|
Create object of the form and use Show or ShowDialog method (as applicable).
|
|
|
|
|
thanks for u r replay my problem is in the tree node selction program
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim childnum, index As Int32
childnum = TreeView1.SelectedNode.GetNodeCount(False)
index = TreeView1.SelectedNode.Index
'index = index + 1
If index = 0 Then
Button2.Show()
GroupBox1.Show()
End If
End Sub
The Above function is not working for me to select tree node and fire,is there any thing wrong in tn my prg.
|
|
|
|
|
I'm not sure I'm completely following you here. The controls are displayed when the index is 1 right? What else are you expecting to occur?
Also, check that you have at least 2 nodes in the treeview since the index is zero based.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I tried the aabove code by making a button visable false and on selcting a perticular treenode it will appear but the same code is not working for the group box that consits of some group of buttons.
I want make that group box visable when i click on a perticular treeview node.
|
|
|
|
|
I tried the aabove code by making a button visable false and on selcting a perticular treenode it will appear but the same code is not working for the group box that consits of some group of buttons.
I want make that group box visable when i click on a perticular treeview node.One more thing i have i have 8 child nodes for my tree so thre is no problem of zero index base.
|
|
|
|
|
Your code looks like it should work. Check the visible property (should be true) on the button controls in the group box to see if visible = true. If not, you'll need to change that at design time or during run time looping the groupbox's control collection.
Quick test app you can do.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'add a group box and stuff with button controls
For Each ctl As Control In GroupBox1.Controls
ctl.Visible = True
Next
GroupBox1.Visible = False
End Sub
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
If e.Node.Index = 5 Then
GroupBox1.Visible = True
End If
End Sub
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Thanks Jon_Boy Your code is working for me. 
|
|
|
|
|
TreeViewEventArgs has all the properties you need. You can use them right away.
Apart from that what exactly is the problem you are facing.
|
|
|
|
|
How does one initiate windows hyperlink dialog selector. By this I do not mean the link label. There is a dialog that is called in C++ with "using (LinkDialog dlg = new LinkDialog())"
With the other dialogs you (color, font, etc) you add them via a control in the toolbox, but I do not find a LinkDialog.
Many thanks
|
|
|
|
|
There is no using statement in C++. Also, if a control exists in MFC, does not mean it exists in .NET. Do you have a link to the control you want, in MSDN ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi Christian,
Ok you are correct. I am currently busy converting a project from C++ to VB.NET (why I dunno but here I find myself doing this) I only notice now amongst the millions (ok not quite millions) of classes and forms and other resources that the previous guy made a LinkDialog class which basically has a textbox to indicate what text must be show and a URL textbox for the link and a dropdown to select target. So that is where it comes from.
So basically I just make another one. Thank you
|
|
|
|
|
Program that someone else wrote. (ProgA)
Program that I wrote. (ProgB)
DLL that someone else wrote (i have the cls file) and I have modified. (DLL1)
I have sample code with an attempt to accomplish my goal if needed.
When ProgA sends a message to DLL1, I need ProgB to see the results of the call from ProgA to DLL1.
|
|
|
|
|
A dll can't call your main app. So, you want to load the same dll instance into both programs. I am not sure if that is possible. Your best bet IMO would be for the dll to use WM_COPYDATA or similar to communicate with the other program, or create some sort of shared storage for the dll to use between instances.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Agreed in that there should be some way to store the info so that both apps can access it.
Is it possible to relaunch app2? If so, you could restart app2 and pass in command line args to have it process whatever needs to be done.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
My goal is to get the RGB colors of a pixel when I click in a picturebox. Every piece of code I've been able to try or find doesn't work. The bit below uses the GDI GetPixel function and should work but returns an Overflow error. I'm using VB 2008 Express.
Dim p As Point = picbox.PointToClient(MousePosition)
Dim g As Graphics = picbox.CreateGraphics()
Dim pbdc As IntPtr = g.GetHdc()
Dim c As Color = ColorTranslator.FromWin32(GetPixel(pbdc, p.X, p.Y))
g.ReleaseHdc(pbdc)
|
|
|
|
|
You seem to be trying to get a pixel from picBox's display context. Is this what you want? If so, then you can simple use (picBox.Image as Bitmap).GetPixel(p.X, p.Y) instead. However, that's just the basic idea. You'll probably want to split it up into separate lines, and add a null-check from picBox.Image. If that's true, you'd probably just want to return a color with 0 transparency
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Thanks Computafreak, that did the trick. It's always the simplest answer that's the right one.
|
|
|
|