Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating lines in a CATIA drawing from a macro in Excel

Status
Not open for further replies.

RickyPhil

Mechanical
Jul 16, 2014
8
US
I am creating a macro in Excel that takes x and y data from a worksheet and then brings them into a CATIA drawing and draws lines. I can get it to draw the lines just fine, but I am having trouble formatting the lines. The problem seems to be with the ".Selection" part. I get the error "Object doesn't support this property or method". Is there another way to format lines without .Selection? I don't know if it makes a difference, but I am doing this in V6.

Sub CATMain()

Dim CATIA As Object
Set CATIA = GetObject(, "CATIA.Application" )

Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets = DrwDocument.Sheets
Set DrwSheet = DrwSheets.ActiveSheet
Set DrwView = DrwSheet.Views.ActiveView
Set Fact = DrwView.Factory2D

Dim Line1 As Object
Set Line1 = Fact.CreateLine(0, 0, Range("A1").Value, Range("B1").Value)
Line1.Name = "Line1"
CATIA.ActiveDocument.Selection.VisProperties.SetRealWidth 3,1

End Sub
 
Replies continue below

Recommended for you

Changing .ActiveDocument to .ActiveEditor worked.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top