When you insert holes into different parts in the assembly coordinate system, the holes are inserted offset, although the coordinates are the same for both parts. Please tell me how to get rid of this.
A snippet of code is shown below.
Insert holes in the first part
Dim swHoleFeature As SldWorks.Feature
Dim swFeat As SldWorks.Feature
Dim swErrors As Long
Dim swWarnings As Long
ReDim KoardOtvKonf(2, line_) As Double
For i = 0 To KolKonf
boolstatus = swPartDocExt.SelectByID2("", "FACE", KoardOtvKonf(0, i), KoardOtvKonf(1, i), KoardOtvKonf(2, i), False, 0, Nothing, 0)
swModel.EditPart
boolstatus = swPartDocExt.SelectByID2("", "FACE", KoardOtvKonf(0, i), KoardOtvKonf(1, i), KoardOtvKonf(2, i), False, 0, Nothing, 0)
Set swFeat = swFeatMgr.HoleWizard5(swWzdHole, swStandardISO, swStandardISODrillSizes, ChrW(216) + "4.5", swEndCondBlind, 0.0045, 0.034, -1, 0, 2.05948851735331, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, "", False, True, True, True, True, False)
Next
swModel.AssemblyPartToggle
swModel.EditAssembly
boolstatus = swModel.Save3(1, swErrors, swWarnings)
Insert holes in a second part
For i = 0 To KolKonf
boolstatus = swPartDocExt.SelectByID2("", "FACE", KoardOtvKonf(0, i), KoardOtvKonf(1, i), KoardOtvKonf(2, i), False, 0, Nothing, 0)
swModel.EditPart
boolstatus = swPartDocExt.SelectByID2("", "FACE", KoardOtvKonf(0, i), KoardOtvKonf(1, i), KoardOtvKonf(2, i), False, 0, Nothing, 0)
Set swFeat = swFeatMgr.HoleWizard5(swWzdHole, swStandardISO, swStandardISODrillSizes, ChrW(216) + "7", swEndCondBlind, 0.0045, 0.025, -1, 0, 2.05948851735331, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, "", False, True, True, True, True, False)
Next
swModel.AssemblyPartToggle
swModel.EditAssembly
boolstatus = swModel.Save3(1, swErrors, swWarnings)
Hole insertion result
Insertion coordinates in a macro
X = 0.25; Y = -0.009; Z = 0.126
Insertion coordinates in the model
A question of the accuracy of the coordinates?
- Board index CAD SolidWorks API
- Search
-
- It is currently Wed Nov 27, 2024 5:02 am
- All times are UTC-05:00
How to achieve the alignment of the insertion holes in the assembly coordinate system?
Programming and macros
How to achieve the alignment of the insertion holes in the assembly coordinate system?
- Quote
- 0 login to like this post
Unread post by POL »
Jump to
- Welcome New Members
- ↳ Welcome
- ↳ Forum Rules
- CAD
- ↳ CAD Agnostic
- ↳ SolidWorks
- ↳ How To Questions
- ↳ SW General
- ↳ SolidWorks FAQ
- ↳ API
- ↳ Macro Library
- ↳ SolidWorks PDM
- ↳ 2D Drawings
- ↳ Routing-Electrical-Piping
- ↳ Surfacing
- ↳ Rendering - Visualize - Photoview
- ↳ SW Simulation
- ↳ SW Motion Analysis
- ↳ Enhancement Requests
- ↳ Solid Edge
- ↳ NX
- ↳ Onshape
- ↳ Creo
- ↳ Inventor
- ↳ Fusion 360
- ↳ KeyCreator
- ↳ Catia and 3DX
- ↳ IronCAD (CAXA)
- ↳ Shapr3D
- ↳ CAD Admin (Install, PDM, etc)
- ↳ subD and Mesh
- ↳ Hardware
- ↳ Misc CAD
- ↳ Draftsight
- Other Technology
- ↳ Computer Aided Engineering
- ↳ Rendering and Motion
- ↳ 3D Scan
- ↳ General Engineering and Design
- ↳ AI and Related Tech
- Manufacturing
- ↳ 3D Print
- ↳ CAM
- ↳ PowerMILL
- ↳ Molding, Casting, Powder Metal
- ↳ Robotics
- Board Business
- ↳ General Biz and Announcements
- ↳ Suggestions
- ↳ What's Wrong?
- ↳ What's New
- ↳ Events
- ↳ Media and Advertising
- Off Topic
- ↳ Kitty Dump
- ↳ Job Listings
- ↳ For Sale and Want To Buy