ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

The Power PC Thread [f*ck off consoles]



  MK4 Anni & MK5 Edt30
I havnt seen any videos yet on the reviews and benchmarks on the new intel cpus, what they been saying?

My current cpu is intel and new one next year was going to be AMD anyway since decided few years ago

They're basically very dissapointing for gaming

BM 1.jpg


BM 2.jpg


BM 3.jpg



BM 4.jpg



I mean this is at 1080p like, so more CPU intensive. The gap won't be as big at 4K gaming as this will be more on the GPU. But still, very dissapointing!
 

The Psychedelic Socialist

ClioSport Club Member
What's the point of benchmarking processors on games like this?

I cannot understand how anyone can write an article with a straight face implying that one processor is better than another because it gets 872fps in a game vs. 751fps.

(yes I know it's objectively 'better' because more, but there are a million things you could benchmark with more relevance to actual use)
 
  MK4 Anni & MK5 Edt30
What's the point of benchmarking processors on games like this?

I cannot understand how anyone can write an article with a straight face implying that one processor is better than another because it gets 872fps in a game vs. 751fps.

(yes I know it's objectively 'better' because more, but there are a million things you could benchmark with more relevance to actual use)

Yeah I totally get that over 500 FPS is a pointless benchmark, but it still should be better than their previous generation. The benchmarks over 200 are still relevant as 360hz monitors exist. Here’s a better graph then with an average across 14 games

14 game average.jpg


The CPU is being slated for gaming, not general other use. Apparently it's great for content creators
 

The Psychedelic Socialist

ClioSport Club Member
Yeah I totally get that over 500 FPS is a pointless benchmark, but it still should be better than their previous generation. The benchmarks over 200 are still relevant as 360hz monitors exist. Here’s a better graph then with an average across 14 games

View attachment 1716157

The CPU is being slated for gaming, not general other use. Apparently it's great for content creators
Yeah that graph makes more sense, but I'd still rather see it at 1440p then 1080p.

...and we could obviously argue for even more time about the relevance of a 360Hz monitor.
 

Geddes

ClioSport Club Member
  Fiesta Mk8 ST-3
with me not doing much gaming at all on my new build for next year, what should i be looking out for so i know what type of cpu is suitable for me , should i be looking at certain benchmarks for stats? cos all i seen is gaming benchmarks, i'll be doing photoshop, having multiple tabs open, maybe i'll be doing a dual monitor next year, YouTube editing that sort of thing, i still don't know wether to go for a 6 core or a 8 core AMD cpu, maybe the X3D would be overkill , if i'm not utilising the full potential of the cpu may aswell save some money on the cpu and gfx card?
 

Darren S

ClioSport Club Member
This i9 v 7800 comparison video shows there isn't much in it at 4k, sometimes the fps was the same.


I've been neglecting running games in 4K, thinking that they would be proper resource killers.

I guess that all depends upon the title in question. I tried Company of Heroes 2 this week, upscaled to 4K and my PC pissed on it - regardless of the carnage, units and busyness on the screen. Could be purely a placebo effect, but it looked like it played even more smoothly at 4K?

I suppose I should always default to that and drop back to 1440 if/when the workload gets a bit too much.
 

Beauvais Motorsport

ClioSport Club Member
I've been neglecting running games in 4K, thinking that they would be proper resource killers.

I guess that all depends upon the title in question. I tried Company of Heroes 2 this week, upscaled to 4K and my PC pissed on it - regardless of the carnage, units and busyness on the screen. Could be purely a placebo effect, but it looked like it played even more smoothly at 4K?

I suppose I should always default to that and drop back to 1440 if/when the workload gets a bit too much.
I'm not sure how upscaling works or running a game a lower resolution than the native monitor regarding pixel pitch but Its something I checked when I bought the gigabyte m32cu. Before on my 1080p monitor, you had about 2 pixel worths of 'target' when zooming on someones head, I think now its like 3-1/2 lol. Makes a difference though, more precision and feels smoother.
 
  MK4 Anni & MK5 Edt30
This i9 v 7800 comparison video shows there isn't much in it at 4k, sometimes the fps was the same.



Yeah there won't be as much in it at higher res as that's more GPU intensive then. However, this video is about the previous generation of Intel not the new one, the 14900k is better than the new ones for gaming.
 

Neil Clio 182

ClioSport Club Member
  Audi TT RS Clio 182
I bought a Alienware Aurora 7 , I7 8700k , 1080ti, M2 SSD, 16gb DDR4 and a Ausus ROG PG278q 165hz 7 years ago now, it was time for an upgrade. I have been hunting deals since september.
Just upgraded to a 7800x3d, 4080 super with 32gb 6000mhz cl30, MSI X670E Gaming Plus WiFi Samsung 990Pro, pre built by a company called Auspec, arrives tomorrow! I also upgraded the monitor with a Alienware 27 QD-OLED Gaming Monitor - AW2725DF which arrived 35h after clicking it on Dells website at 11pm.
Monitor and PC was over £600 more 7 years ago!
Can't wait to get gaming!
 

Attachments

  • s-l1600.jpg
    s-l1600.jpg
    224 KB · Views: 31

Neil Clio 182

ClioSport Club Member
  Audi TT RS Clio 182
Getting 290 FPS on Cod in 1440p after a bit of tweeking :)
I need to sort out a better DP cable as this one is 4.5m long. (too long)
07c152a1-1726-4703-9e8e-e64b7ecbdebf.jpg
 

mace¬

ClioSport Club Member
  Clio
Daughter wants a PC for Christmas and I don't want to blow the bank as it might be a phase and she gets bored.

I've decided the best performance for money option is a refurbished one. I'm guessing she'll be playing a bit of Minecraft and Roblox mostly.

Any recommendations of decent reputable websites to get one?

Also for future proofing what would you recommend minimum spec?

Something like this
 
Last edited:

mace¬

ClioSport Club Member
  Clio
Or am I over thinking this and for an 8 year old running at 1080p this would be sufficent for a few years

 

The Psychedelic Socialist

ClioSport Club Member
Bought a 4070 Super last month to replace my old 1070 Ti (which I'll be selling when I get around to taking pictures).

Decided to see what it can do by downloading and spending all my spare time playing Balatro.

Mug.
 

Cookie

ClioSport Club Member
Anyone have a 3080 Ti (or fasterer) they need to find a new home for? Sick of my 6900 XT with constant driver issues so looking to go back to Team Green
 

Neil Clio 182

ClioSport Club Member
  Audi TT RS Clio 182
Oled Monitors are where its at! had my aw2725df couple of weeks now upgraded from a high end IPS and every time I switch it on It's Wow!
£509 from dell with quidoco cashback. With I could afford a G9 for my Rig now.
 

Ph1 Tom

ClioSport Club Member
Anyone have a 3080 Ti (or fasterer) they need to find a new home for? Sick of my 6900 XT with constant driver issues so looking to go back to Team Green
What specific issues are you having? Never had any issues with mine. Had issues with Nvidia drivers and CoD though.
 

Cookie

ClioSport Club Member
Not worth holding out for the 50x series annoucement soon and getting a better deal on the 40x series?
Nope. I'm getting CTD constantly in games at this point unless I strip the driver back which has killed performance somewhat. Makes no odds which game, what settings I use. I've used maybe 10 drivers to try and find one that works. I think it was potentially a Windows update that's clashing with the driver but I get zero error logs on anything, it just turns the machine off 😂

Stress testing it/benchmarking its completely stable

Sitting and waiting for the shiny new thing that might end up being unavailable for 3 months isn't really something I want to do either!
 

Daz...

ClioSport Club Member
  Inferno 182 Cup
Nope. I'm getting CTD constantly in games at this point unless I strip the driver back which has killed performance somewhat. Makes no odds which game, what settings I use. I've used maybe 10 drivers to try and find one that works. I think it was potentially a Windows update that's clashing with the driver but I get zero error logs on anything, it just turns the machine off 😂

Stress testing it/benchmarking its completely stable

Sitting and waiting for the shiny new thing that might end up being unavailable for 3 months isn't really something I want to do either!
That sounds like it’s either a dying GPU or PSU.

The only issues I’ve had with my 7900XTX turned out to be it being a bit power hungry and pulling more than the PSU could handle.

I’ve undervolted and dropped the frequency on it and it uses half the power but with no noticeable difference to performance.

Also, did you swap from Nvidia to AMD and just use DDU to wipe it? Sounds simple but a fresh install of windows will fix many stupid little problems you don’t realise are there.
 

Greeny.

ClioSport Club Member
  440i + 182
Oled Monitors are where its at! had my aw2725df couple of weeks now upgraded from a high end IPS and every time I switch it on It's Wow!
£509 from dell with quidoco cashback. With I could afford a G9 for my Rig now.

I’ve not bothered looking into them for PC’s due to being very happy with my LG 34" 34GN850P-B 160Hz 1ms “Nano” IPS from 2020, that’s the problem for me, unless this dies I don’t wanna replace it as it cost 1k.

How’s the refresh rate and FPS side of Oled PC monitors atm?
 

Ph1 Tom

ClioSport Club Member
I’ve not bothered looking into them for PC’s due to being very happy with my LG 34" 34GN850P-B 160Hz 1ms “Nano” IPS from 2020, that’s the problem for me, unless this dies I don’t wanna replace it as it cost 1k.

How’s the refresh rate and FPS side of Oled PC monitors atm?
I've got a 4k 144hz oled TV and a LG 4k 160hz IPS monitor. I couldn't tell you if there's a difference or not, unlike going from 1440p to 4k. Like you, I bought it in 2020 and I have no need to change it.
 

Cookie

ClioSport Club Member
That sounds like it’s either a dying GPU or PSU.

The only issues I’ve had with my 7900XTX turned out to be it being a bit power hungry and pulling more than the PSU could handle.

I’ve undervolted and dropped the frequency on it and it uses half the power but with no noticeable difference to performance.

Also, did you swap from Nvidia to AMD and just use DDU to wipe it? Sounds simple but a fresh install of windows will fix many stupid little problems you don’t realise are there.

Could be, but the system is rock solid getting hammered with OCCT/Furmark/3DMark etc. It's been fine until relatively recently, I reckon around the time Blackops 6 was released it started getting a bit flaky with COD, so I put the driver version back and COD was fine (ish, it'd CTD once a night rather than 5)

Not an issue with having Nvidia drivers anywhere on this system, it was a fresh W11 build with all of the components in this machine

I think perhaps saying constant issues was wrong.. sometimes it'll black screen the whole box and shut down after 10 minutes, sometimes after 30. Sometimes (COD, for example) is fine for hours. I've been monitoring temps for everything and its not been exceeding thermal limits at all. 12V rails seem steady, nothing spiking that I could tell. Just likes to die.

Guess we'll see if the new card shows similar symptoms 😂
 
Last edited:

Neil Clio 182

ClioSport Club Member
  Audi TT RS Clio 182
I’ve not bothered looking into them for PC’s due to being very happy with my LG 34" 34GN850P-B 160Hz 1ms “Nano” IPS from 2020, that’s the problem for me, unless this dies I don’t wanna replace it as it cost 1k.

How’s the refresh rate and FPS side of Oled PC monitors atm?

360hz on my 1440p Alienware and minimal input lag.
 

Neil Clio 182

ClioSport Club Member
  Audi TT RS Clio 182
The Nvidia over clock app is ok, better results with MSI afterburner though. My max score on my 1080ti was just over 6k on Furmark 3d. New Pc is doing a little better! Need more to max out the monitor lol.
467483305_923835309294266_9216090363935467627_n.jpg
 

Ph1 Tom

ClioSport Club Member
Could be, but the system is rock solid getting hammered with OCCT/Furmark/3DMark etc. It's been fine until relatively recently, I reckon around the time Blackops 6 was released it started getting a bit flaky with COD, so I put the driver version back and COD was fine (ish, it'd CTD once a night rather than 5)

Not an issue with having Nvidia drivers anywhere on this system, it was a fresh W11 build with all of the components in this machine

I think perhaps saying constant issues was wrong.. sometimes it'll black screen the whole box and shut down after 10 minutes, sometimes after 30. Sometimes (COD, for example) is fine for hours. I've been monitoring temps for everything and its not been exceeding thermal limits at all. 12V rails seem steady, nothing spiking that I could tell. Just likes to die.

Guess we'll see if the new card shows similar symptoms 😂
Mine did similar a while back. Turned out to be a dodgy hard drive.
 

Cookie

ClioSport Club Member
Mine did similar a while back. Turned out to be a dodgy hard drive.
Not had an actual hard drive in years 😂

Both nvme drives are fine

Anyway, I waited in all day for Amazon and they just arrived, right as I need to put the kids to bed and then take the dog for a walk 😢
 

Beauvais Motorsport

ClioSport Club Member
@SharkyUK @Robbie Corbett
I have started my journey into c# for a solidworks add in, fortunately there is a solidworks template for visual studio that helps to start things off. Ive been using chatgpt which honestly has been a requirement for me to do this, I just dont have the time to learn everything without it!

I started by trying to make my own cad application that would be only for generating rack gears, I soon realised even with chatgpt this was more hassle than its worth, I managed to make this and there are weird bugs like when you resize the application the visual disappears until you press generate again or toggle the shaded edges, chatgpt couldnt figure it out after hours so I'm moving to keep things within solidworks.

Also export to step wouldnt work no matter what and some other small bugs persist. Would of taken me 100x longer if I didnt use chatgpt though!

Screenshot 2024-12-16 214331.png


It was better at helping to write the code for this application though, you have to be very specific sometimes.

Screenshot 2024-12-16 214642.png
 

SharkyUK

ClioSport Club Member
@SharkyUK @Robbie Corbett
I have started my journey into c# for a solidworks add in, fortunately there is a solidworks template for visual studio that helps to start things off. Ive been using chatgpt which honestly has been a requirement for me to do this, I just dont have the time to learn everything without it!

I started by trying to make my own cad application that would be only for generating rack gears, I soon realised even with chatgpt this was more hassle than its worth, I managed to make this and there are weird bugs like when you resize the application the visual disappears until you press generate again or toggle the shaded edges, chatgpt couldnt figure it out after hours so I'm moving to keep things within solidworks.

Also export to step wouldnt work no matter what and some other small bugs persist. Would of taken me 100x longer if I didnt use chatgpt though!

View attachment 1723461

It was better at helping to write the code for this application though, you have to be very specific sometimes.

View attachment 1723463

Nice! Was the application stand-alone, or does it rely on Solidworks being installed in order to run?
 

Beauvais Motorsport

ClioSport Club Member
First add in made which makes a cylinder as a test, only a few lines of code... :rolleyes: Thankfully there is a template you can modify or use as a reference though it was still effort.

Screenshot 2024-12-18 073210.png


using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using SolidWorks.Interop.swpublished;
using SolidWorksTools;
using SolidWorksTools.File;
using System.Collections.Generic;
using System.Diagnostics;

using System;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;

namespace Sw_Code_From_Scratch_Test
{

[Guid("AB3F8214-9501-425D-8B8B-A2ABB15923C9"), ComVisible(true)]

[SwAddin(
Description = "Testing if all functions/features work from my own code",
Title = "Solidworks_add_in_code_from_scratch",
LoadAtStartup = true
)]


public class SwAddin : ISwAddin
{

#region Local Variables
ISldWorks iSwApp = null;
ICommandManager iCmdMgr = null;
int addinID = 0;
BitmapHandler iBmp;
int registerID;

public const int mainCmdGroupID = 1;
public const int mainItemID1 = 1;

string[] icons = new string[1];


#region Event Handler Variables
Hashtable openDocs = new Hashtable();
SolidWorks.Interop.sldworks.SldWorks SwEventPtr = null;
#endregion


#region Property Manager Variables
public UserPMPage ppage = null;
#endregion

#region Public Properties
public ISldWorks SwApp
{
get { return iSwApp; }
}
public ICommandManager CmdMgr
{
get { return iCmdMgr; }
}

public Hashtable OpenDocs
{
get { return openDocs; }
}
#endregion


#region SolidWorks Registration
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type t)
{
#region Get Custom Attribute: SwAddinAttribute
SwAddinAttribute SWattr = null;
Type type = typeof(SwAddin);

foreach (System.Attribute attr in type.GetCustomAttributes(false))
{
if (attr is SwAddinAttribute)
{
SWattr = attr as SwAddinAttribute;
break;
}
}

#endregion

try
{
Microsoft.Win32.RegistryKey hklm = Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey hkcu = Microsoft.Win32.Registry.CurrentUser;

string keyname = "SOFTWARE\\SolidWorks\\Addins\\{" + t.GUID.ToString() + "}";
Microsoft.Win32.RegistryKey addinkey = hklm.CreateSubKey(keyname);
addinkey.SetValue(null, 0);

addinkey.SetValue("Description", SWattr.Description);
addinkey.SetValue("Title", SWattr.Title);

keyname = "Software\\SolidWorks\\AddInsStartup\\{" + t.GUID.ToString() + "}";
addinkey = hkcu.CreateSubKey(keyname);
addinkey.SetValue(null, Convert.ToInt32(SWattr.LoadAtStartup), Microsoft.Win32.RegistryValueKind.DWord);
}
catch (System.NullReferenceException nl)
{
Console.WriteLine("There was a problem registering this dll: SWattr is null. \n\"" + nl.Message + "\"");
System.Windows.Forms.MessageBox.Show("There was a problem registering this dll: SWattr is null.\n\"" + nl.Message + "\"");
}

catch (System.Exception e)
{
Console.WriteLine(e.Message);

System.Windows.Forms.MessageBox.Show("There was a problem registering the function: \n\"" + e.Message + "\"");
}
}

[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type t)
{
try
{
Microsoft.Win32.RegistryKey hklm = Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey hkcu = Microsoft.Win32.Registry.CurrentUser;

string keyname = "SOFTWARE\\SolidWorks\\Addins\\{" + t.GUID.ToString() + "}";
hklm.DeleteSubKey(keyname);

keyname = "Software\\SolidWorks\\AddInsStartup\\{" + t.GUID.ToString() + "}";
hkcu.DeleteSubKey(keyname);
}
catch (System.NullReferenceException nl)
{
Console.WriteLine("There was a problem unregistering this dll: " + nl.Message);
System.Windows.Forms.MessageBox.Show("There was a problem unregistering this dll: \n\"" + nl.Message + "\"");
}
catch (System.Exception e)
{
Console.WriteLine("There was a problem unregistering this dll: " + e.Message);
System.Windows.Forms.MessageBox.Show("There was a problem unregistering this dll: \n\"" + e.Message + "\"");
}
}

#endregion


#region ISwAddin Implementation
public SwAddin()
{
}

public bool ConnectToSW(object ThisSW, int cookie)
{
iSwApp = (ISldWorks)ThisSW;
addinID = cookie;

//Set up callbacks
iSwApp.SetAddinCallbackInfo2(0, this, addinID);

#region Set up the CommandManager
iCmdMgr = iSwApp.GetCommandManager(cookie);
AddCommandMgr();
#endregion

return true;
}

public bool DisconnectFromSW()
{
RemoveCommandMgr();

System.Runtime.InteropServices.Marshal.ReleaseComObject(iCmdMgr);
iCmdMgr = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(iSwApp);
iSwApp = null;
// The add-in must call GC.Collect() here in order to retrieve all managed code pointers
GC.Collect();
GC.WaitForPendingFinalizers();

GC.Collect();
GC.WaitForPendingFinalizers();

return true;
}
#endregion

#region UI Methods
public void AddCommandMgr()
{
ICommandGroup cmdGroup;

int cmdIndex0;
string Title = "C# Addin", ToolTip = "C# Addin";

// Define the document types where the tab should appear
int[] docTypes = new int[] {
(int)swDocumentTypes_e.swDocASSEMBLY,
(int)swDocumentTypes_e.swDocDRAWING,
(int)swDocumentTypes_e.swDocPART
};

int cmdGroupErr = 0;
bool ignorePrevious = false;

object registryIDs;
bool getDataResult = iCmdMgr.GetGroupDataFromRegistry(mainCmdGroupID, out registryIDs);

int[] knownIDs = new int[1] { mainItemID1 };

if (getDataResult)
{
if (!CompareIDs((int[])registryIDs, knownIDs))
{
// If the IDs don't match, reset the command group
ignorePrevious = true;
}
}

cmdGroup = iCmdMgr.CreateCommandGroup2(
mainCmdGroupID,
Title,
ToolTip,
"",
-1,
ignorePrevious,
ref cmdGroupErr
);

// Set the custom icon for the command group
string pathToIcon = @"C:\Users\Beauvais\Desktop\Sw Code From Scratch Test\Sw Code From Scratch Test\CadCylinderIcon32.png";

if (!System.IO.File.Exists(pathToIcon))
{
System.Windows.Forms.MessageBox.Show($"Icon file not found: {pathToIcon}");
return;
}

// Assign icon paths for both 16x16 and 32x32 (using the same icon here)
cmdGroup.IconList = new string[] { pathToIcon, pathToIcon };
cmdGroup.MainIconList = new string[] { pathToIcon, pathToIcon };

int menuToolbarOption = (int)(swCommandItemType_e.swMenuItem | swCommandItemType_e.swToolbarItem);

// Add a button with the custom icon
cmdIndex0 = cmdGroup.AddCommandItem2(
"CreateCylinder",
0,
"Creates a Cylinder With a o/d of 50mm and length of 100m",
"Create a Cylinder",
0,
nameof(CreateCylinder), // Method name as string for callback
"",
mainItemID1,
menuToolbarOption
);

cmdGroup.HasToolbar = true;
cmdGroup.HasMenu = true;
cmdGroup.Activate();

// Add the command tab
foreach (int type in docTypes)
{
CommandTab cmdTab;

cmdTab = iCmdMgr.GetCommandTab(type, Title);

if (cmdTab != null && (!getDataResult || ignorePrevious))
{
// If the tab exists but registry info was ignored, recreate it
bool res = iCmdMgr.RemoveCommandTab(cmdTab);
cmdTab = null;
}

if (cmdTab == null)
{
cmdTab = iCmdMgr.AddCommandTab(type, Title);

CommandTabBox cmdBox = cmdTab.AddCommandTabBox();

int[] cmdIDs = new int[1];
int[] TextType = new int[1];

cmdIDs[0] = cmdGroup.get_CommandID(cmdIndex0);
TextType[0] = (int)swCommandTabButtonTextDisplay_e.swCommandTabButton_TextBelow;

cmdBox.AddCommands(cmdIDs, TextType);
}
}
}



public void RemoveCommandMgr()
{
iCmdMgr.RemoveCommandGroup(mainCmdGroupID);
}

public bool CompareIDs(int[] storedIDs, int[] addinIDs)
{
List<int> storedList = new List<int>(storedIDs);
List<int> addinList = new List<int>(addinIDs);

addinList.Sort();
storedList.Sort();

if (addinList.Count != storedList.Count)
{
return false;
}
else
{

for (int i = 0; i < addinList.Count; i++)
{
if (addinList != storedList)
{
return false;
}
}
}
return true;
}

#endregion

#region ui callbacks
public void CreateCylinder()

{
//make sure we have a part open
string partTemplate = iSwApp.GetUserPreferenceStringValue((int)swUserPreferenceStringValue_e.swDefaultTemplatePart);
if ((partTemplate != null) && (partTemplate != ""))
{
IModelDoc2 modDoc = (IModelDoc2)iSwApp.NewDocument(partTemplate, (int)swDwgPaperSizes_e.swDwgPaperA2size, 0.0, 0.0);

ISketchManager sketchMgr = modDoc.SketchManager;

sketchMgr.InsertSketch(true);
sketchMgr.CreateCircle(0, 0, 0, 0.025, 0, 0);

//extrude the sketch
IFeatureManager featMan = modDoc.FeatureManager;
featMan.FeatureExtrusion(true,
false, false,
(int)swEndConditions_e.swEndCondBlind, (int)swEndConditions_e.swEndCondBlind,
0.1, 0.0,
false, false,
false, false,
0.0, 0.0,
false, false,
false, false,
true,
false, false);
}
else
{
System.Windows.Forms.MessageBox.Show("There is no part template available. Please check your options and make sure there is a part template selected, or select a new part template.");
}
}
public void PopupCallbackFunction()
{
bool bRet;

bRet = iSwApp.ShowThirdPartyPopupMenu(registerID, 500, 500);
}

public int PopupEnable()
{
if (iSwApp.ActiveDoc == null)
return 0;
else
return 1;
}

public void TestCallback()
{
Debug.Print("Test Callback, CSharp");
}

public int EnableTest()
{
if (iSwApp.ActiveDoc == null)
return 0;
else
return 1;
}
#endregion

#region Event Methods
public bool AttachEventHandlers()
{
AttachSwEvents();
//Listen for events on all currently open docs
AttachEventsToAllDocuments();
return true;
}
private bool AttachSwEvents()
{
try
{
SwEventPtr.ActiveDocChangeNotify += new DSldWorksEvents_ActiveDocChangeNotifyEventHandler(OnDocChange);
SwEventPtr.DocumentLoadNotify2 += new DSldWorksEvents_DocumentLoadNotify2EventHandler(OnDocLoad);
SwEventPtr.FileNewNotify2 += new DSldWorksEvents_FileNewNotify2EventHandler(OnFileNew);
SwEventPtr.ActiveModelDocChangeNotify += new DSldWorksEvents_ActiveModelDocChangeNotifyEventHandler(OnModelChange);
SwEventPtr.FileOpenPostNotify += new DSldWorksEvents_FileOpenPostNotifyEventHandler(FileOpenPostNotify);
return true;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return false;
}
}



private bool DetachSwEvents()
{
try
{
SwEventPtr.ActiveDocChangeNotify -= new DSldWorksEvents_ActiveDocChangeNotifyEventHandler(OnDocChange);
SwEventPtr.DocumentLoadNotify2 -= new DSldWorksEvents_DocumentLoadNotify2EventHandler(OnDocLoad);
SwEventPtr.FileNewNotify2 -= new DSldWorksEvents_FileNewNotify2EventHandler(OnFileNew);
SwEventPtr.ActiveModelDocChangeNotify -= new DSldWorksEvents_ActiveModelDocChangeNotifyEventHandler(OnModelChange);
SwEventPtr.FileOpenPostNotify -= new DSldWorksEvents_FileOpenPostNotifyEventHandler(FileOpenPostNotify);
return true;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return false;
}

}

public void AttachEventsToAllDocuments()
{
ModelDoc2 modDoc = (ModelDoc2)iSwApp.GetFirstDocument();
while (modDoc != null)
{
if (!openDocs.Contains(modDoc))
{
AttachModelDocEventHandler(modDoc);
}
else if (openDocs.Contains(modDoc))
{
bool connected = false;
DocumentEventHandler docHandler = (DocumentEventHandler)openDocs[modDoc];
if (docHandler != null)
{
connected = docHandler.ConnectModelViews();
}
}

modDoc = (ModelDoc2)modDoc.GetNext();
}
}

public bool AttachModelDocEventHandler(ModelDoc2 modDoc)
{
if (modDoc == null)
return false;

DocumentEventHandler docHandler = null;

if (!openDocs.Contains(modDoc))
{
switch (modDoc.GetType())
{
case (int)swDocumentTypes_e.swDocPART:
{
docHandler = new PartEventHandler(modDoc, this);
break;
}
case (int)swDocumentTypes_e.swDocASSEMBLY:
{
docHandler = new AssemblyEventHandler(modDoc, this);
break;
}
case (int)swDocumentTypes_e.swDocDRAWING:
{
docHandler = new DrawingEventHandler(modDoc, this);
break;
}
default:
{
return false; //Unsupported document type
}
}
docHandler.AttachEventHandlers();
openDocs.Add(modDoc, docHandler);
}
return true;
}

public bool DetachModelEventHandler(ModelDoc2 modDoc)
{
DocumentEventHandler docHandler;
docHandler = (DocumentEventHandler)openDocs[modDoc];
openDocs.Remove(modDoc);
modDoc = null;
docHandler = null;
return true;
}

public bool DetachEventHandlers()
{
DetachSwEvents();

//Close events on all currently open docs
DocumentEventHandler docHandler;
int numKeys = openDocs.Count;
object[] keys = new Object[numKeys];

//Remove all document event handlers
openDocs.Keys.CopyTo(keys, 0);
foreach (ModelDoc2 key in keys)
{
docHandler = (DocumentEventHandler)openDocs[key];
docHandler.DetachEventHandlers(); //This also removes the pair from the hash
docHandler = null;
}
return true;
}
#endregion

#region Event Handlers
//Events
public int OnDocChange()
{
return 0;
}

public int OnDocLoad(string docTitle, string docPath)
{
return 0;
}

int FileOpenPostNotify(string FileName)
{
AttachEventsToAllDocuments();
return 0;
}

public int OnFileNew(object newDoc, int docType, string templateName)
{
AttachEventsToAllDocuments();
return 0;
}

public int OnModelChange()
{
return 0;
}

#endregion



}
}
#endregion

 


Top