| |
 | Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für SOLIDWORKS |
| |
 | SIMULIA Regional User Meeting 2025 | 5.-7. Mai in Bamberg, eine Veranstaltung am 05.05.2025
|
Autor
|
Thema: Problem with small units / SldWrks API / External Access (970 mal gelesen)
|
Zzzziesta Mitglied Architekt
 Beiträge: 5 Registriert: 15.09.2009
|
erstellt am: 15. Sep. 2009 19:55 <-- editieren / zitieren --> Unities abgeben:         
Hi, I have a question regararding the API, I am fairly new to the API. I am using VB Visual Studio .Net Express to write an external application for Solid Works 2008. When I want to draw a very small rectangle into a sketch (by small I mean merely 5mm) it doesnt draw it at all. Strange thing is that if I run the same code in the internal vb editor, it does draw it.... If I change the size to 50mm it does draw it from the external program... Strange... Has anyone encountered this problem before? Please let me know what I can do... The entire program would be useless otherwise... Thanks! Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
jens_oliver Mitglied Softwareentwickler
 
 Beiträge: 114 Registriert: 28.06.2005
|
erstellt am: 16. Sep. 2009 08:10 <-- editieren / zitieren --> Unities abgeben:          Nur für Zzzziesta
|
Zzzziesta Mitglied Architekt
 Beiträge: 5 Registriert: 15.09.2009
|
erstellt am: 16. Sep. 2009 09:52 <-- editieren / zitieren --> Unities abgeben:         
I didnt use AddtoDB. So I tried this: Dim d = 0.0015 mStandard(2).Select2(True, 0) mMod.InsertSketch2(False) mMod.SketchManager.AddToDB = True mMod.SketchManager.CreateCornerRectangle(-d, d, 0, d, -d, 0) mMod.InsertSketch2(False) mMod.ClearSelection() mStandard(2) is reference to the Front Plane Feature. Strange thing is, that the above code works down to d=0.0016, but d=0.0015 it wont draw... This is really annoying... Any idea whats wrong? Could it be because of some kind of snap function or grid that is on? Cheers, Ben Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
mkkk Mitglied
 
 Beiträge: 105 Registriert: 04.03.2005
|
erstellt am: 16. Sep. 2009 10:46 <-- editieren / zitieren --> Unities abgeben:          Nur für Zzzziesta
|
StefanBerlitz Guter-Geist-Moderator IT Admin (CAx)

 Beiträge: 8756 Registriert: 02.03.2000 SunZu sagt: Analysiere die Vorteile, die du aus meinem Ratschlag ziehst. Dann gliedere deine Kräfte entsprechend und mache dir außergewöhnliche Taktiken zunutze.
|
erstellt am: 16. Sep. 2009 10:55 <-- editieren / zitieren --> Unities abgeben:          Nur für Zzzziesta
Hi Ben Zitat: Original erstellt von Zzzziesta: Any idea whats wrong? Could it be because of some kind of snap function or grid that is on?
Yes, this behaviour is usually the internal snapping. However, this should cause no issues if you add the sketch entities directly to the database. To achieve this you have to set AddToDB for the sketch manager or SetAddToDB for the modeldoc like Jens said. Maybe you should set AddToDB to True before inserting the new sketch, but I havn't tried that. Bye, Stefan ------------------ Inoffizielle deutsche SolidWorks Hilfeseite http://solidworks.cad.de Stefans SolidWorks Blog Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
Zzzziesta Mitglied Architekt
 Beiträge: 5 Registriert: 15.09.2009
|
erstellt am: 16. Sep. 2009 11:18 <-- editieren / zitieren --> Unities abgeben:         
Hi, I tried the following: Dim d = 0.0015 mMod.SetUserPreferenceToggle(swUserPreferenceToggle_e.swSketchInference, False) mStandard(2).Select2(True, 0) mMod.InsertSketch2(False) mMod.SketchManager.CreateCornerRectangle(-d, d, 0, d, -d, 0) mMod.InsertSketch2(False) mMod.ClearSelection() And a call to both: mMod.SetAddToDB(True) as well as mMod.SketchManager.AddtoDB = True both before and after mMod.InsertSketch2. Same result. It draws the rectangle when d=0.0016 but not when d=0.0015. Most unfortunately, d=0.0015 is the actual dimension I need... Any other ideas why this is happening? Thanks again, Ben Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
mkkk Mitglied
 
 Beiträge: 105 Registriert: 04.03.2005
|
erstellt am: 16. Sep. 2009 11:42 <-- editieren / zitieren --> Unities abgeben:          Nur für Zzzziesta
Zitat: Original erstellt von Zzzziesta: Hi,I tried the following: Dim d = 0.0015 mMod.SetUserPreferenceToggle(swUserPreferenceToggle_e.swSketchInference, False) mStandard(2).Select2(True, 0) mMod.InsertSketch2(False) mMod.SketchManager.CreateCornerRectangle(-d, d, 0, d, -d, 0) mMod.InsertSketch2(False) mMod.ClearSelection() And a call to both: mMod.SetAddToDB(True) as well as mMod.SketchManager.AddtoDB = True both before and after mMod.InsertSketch2. Same result. It draws the rectangle when d=0.0016 but not when d=0.0015. Most unfortunately, d=0.0015 is the actual dimension I need... Any other ideas why this is happening? Thanks again, Ben
Not using this: mMod.SetUserPreferenceToggle(swUserPreferenceToggle_e.swSketchInference, False) Use this (system option!!): swapp.SetUserPreferenceToggle(swUserPreferenceToggle_e.swSketchInference, False) Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
Zzzziesta Mitglied Architekt
 Beiträge: 5 Registriert: 15.09.2009
|
erstellt am: 16. Sep. 2009 12:38 <-- editieren / zitieren --> Unities abgeben:         
|
mkkk Mitglied
 
 Beiträge: 105 Registriert: 04.03.2005
|
erstellt am: 16. Sep. 2009 12:43 <-- editieren / zitieren --> Unities abgeben:          Nur für Zzzziesta
|