How to select dimension in draft SE20?

 

Hi,

I am trying to select dimensions in draft module thorugh VB6 code. But I don't know where to start!

Any source code will be helpful.

Please help,

MG

 

 

 

Posted by: marijan glavac
Post date: 8/3/2009 10:33:42 PM

11 REPLIES

RE: How to select dimension in draft SE20?

Hey,

 

This code example connects to a collection of dimensions in the first sheet. I haven't tested it, but it should get you started.

 

Good luck!

 

Wouter

 

Public Sub DraftDimentions()

On Error Resume Next

 

Dim objApp As SolidEdgeFramework.Application

Dim objDoc As SolidEdgeDraft.DraftDocument

Dim objSheet As SolidEdgeDraft.Sheet

 

Dim objDimensions As SolidEdgeFrameworkSupport.Dimensions

Dim objDimension As SolidEdgeFrameworkSupport.Dimensions

 

Dim strFName As String

 

Dim i As Integer

 

strFName = "myDraft.dft"

 

'Get SE ans open doc

Set objApp = GetObject(, "SolidEdge.Application")

 

If Err Then

Err.Clear

Set objApp = CreateObject("SolidEdge.Application")

End If

 

objApp.Visible = True

objApp.Activate

objApp.DisplayAlerts = True

objApp.DisplayFullScreen = True

 

'Set

Set objDoc = objApp.Documents.Open(strFName)

Set objSheet = objDoc.Sections.WorkingSection.Sheets(1)

Set objDimensions = objSheet.Dimensions

 

'Connect to the dimentions

For i = 1 To objDimensions.Count

Set objDimension = objDimensions.Item(i)

 

'DO WHAT EVER YOU WANT HERE >>>>>>>>>>>>

 

Next

 

'Destroy Variables

Set objApp = Nothing

Set objDoc = Nothing

Set objSheet = Nothing

Set objDimensions = Nothing

Set objDimension = Nothing

 

End Sub

 

Posted by: Wouter Sloof
Post date: 8/4/2009 9:26:49 PM

RE: How to select dimension in draft SE20?

 

Thank you !

It is a great help. Do you know how to select dimension on draft with mouse and get all dimension information (sufix,prefix) ?.That I need a most.

 

 

Posted by: marijan glavac
Post date: 8/7/2009 3:23:19 AM

RE: How to select dimension in draft SE20?

No sorry, I don't know that.

 

Posted by: Wouter Sloof
Post date: 8/9/2009 11:45:08 PM

RE: How to select dimension in draft SE20?

Hi,

 

try this:

Public Sub DraftDimentions()

On Error Resume Next

 

Dim objApp As SolidEdgeFramework.Application

Dim objDoc As SolidEdgeDraft.DraftDocument

Dim objSheet As SolidEdgeDraft.Sheet

Dim objDimensions As SolidEdgeFrameworkSupport.Dimensions

Dim objDimension As SolidEdgeFrameworkSupport.Dimension

Dim i As Integer

Dim objSelSet As SolidEdgeFramework.SelectSet

Dim pre_fix As String

Dim suff_fix As String

'Dim objHSets As SolidEdgeFramework.HighlightSets

'Dim objHSet As SolidEdgeFramework.HighlightSet

 

'Get SE ans open doc

Set objApp = GetObject(, "SolidEdge.Application")

'Set

Set objDoc = objApp.ActiveDocument

Set objSheet = objDoc.Sections.WorkingSection.Sheets(2)

Set objDimensions = objSheet.Dimensions

Set objSelSet = objDoc.SelectSet

'Set objHSets = objDoc.HighlightSets

 

'Connect to the dimentions

For i = 1 To objDimensions.Count

Set objDimension = Nothing

Set objDimension = objDimensions(i)

pre_fix = objDimension.PrefixString

suff_fix = objDimension.SuffixString

'Select in the Draft

Call objSelSet.Add(objDimension)

'Highlight if need

'Set objHSet = objHSets.Add

'objHSet.AddSelected

'objHSet.Draw

Next

 

'Destroy Variables

Set objApp = Nothing

Set objDoc = Nothing

Set objSheet = Nothing

Set objDimensions = Nothing

Set objDimension = Nothing

Set objSelSet = Nothing

 

End Sub

 

Regards

jr

 

Posted by: JR
Post date: 8/10/2009 10:36:58 PM

RE: How to select dimension in draft SE20?

I need to select dimension with mouse in draft and from thet selectetd dimension get information.

 

 

Posted by: marijan glavac
Post date: 8/12/2009 12:50:30 AM

RE: How to select dimension in draft SE20?

do you want to move the mouse and click on the dimension?

 

Posted by: JR
Post date: 8/12/2009 12:55:26 AM

RE: How to select dimension in draft SE20?

yes , and from selected dimension get all information (suffix,prefix)

 

Posted by: marijan glavac
Post date: 8/12/2009 12:58:32 AM

RE: How to select dimension in draft SE20?

I don't know that. Without move the mouse see coding above (SelectSet).

You can read the position of the mouse, but move ...? I think this is not so simply, maybe with Windows API... (?)

 

Posted by: JR
Post date: 8/12/2009 1:15:07 AM

RE: How to select dimension in draft SE20?

Must be some simple way.

When I want to do same thing in VBA for AutoCad or ZWCad I use code:

 

Dim returnObj As ZwcadEntity

Dim basePnt As ZwcadPoint

 

ThisDocument.Utility.GetEntity returnObj, basePnt, "select object :"

Debug.Print returnObj.EntityName

 

On graphical screen I can select what ever I want.

How to do that in SE ?

 

Posted by: marijan glavac
Post date: 8/12/2009 1:26:15 AM