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!

How to make "Isolated Point" in VBScript? 1

Status
Not open for further replies.

tpalsl125

Automotive
Apr 24, 2015
44
DE
Hello, guys

1_mcqmod.jpg


Like upper picture, I wnat to make a isolated point in vbscript.

Also I tried to make this on recording macro. But It was failed.

Could you tell me how to make it?

Thanks a lot,
Mr. Oh
 
Replies continue below

Recommended for you

Thanks for your reply.

I mean I want to creat a isolated point.

Yesterday, I tried to like this format. This works also what I want.

But I think this is very LONG script. I just want to creat one isolated point. just one point.

So could you creat it as simply?


Set hybridShapeFactory1 = part1.HybridShapeFactory

Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(0, 0, 0)

hybridBody1.AppendHybridShape hybridShapePointCoord1

part1.InWorkObject = hybridShapePointCoord1

part1.Update

Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord1)

Set hybridShapePointExplicit1 = hybridShapeFactory1.AddNewPointDatum(reference2)

hybridBody1.AppendHybridShape hybridShapePointExplicit1

part1.InWorkObject = hybridShapePointExplicit1

hybridShapeFactory1.DeleteObjectForDatum reference2

part1.Update
 
Hello,
I am trying to make a replace feature. It also works with startcommand function?
 
In my template of part I have an axis system, that I need to replace to work in the assembly position. My parts are always located in 0,0,0. But the drawn part most of the time no. So I need to copy with link an axis system that is located in a skeleton part, and then replace the one that I have in the new part.
 
Your code looks right. Remember, regardless of how long the code is, it would take much, much longer to create the point manually.

You can shorten the recorded variable names and remove unnecessary lines to shorten it. Also, some creation features do not need a reference...I can't remember if PointDatum is one, but you can give it a try.

Also, use the code blocks. Below code takes you from 11 lines to 7.

Code:
Set hybridShapeFactory1 = part1.HybridShapeFactory

Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(0, 0, 0)
'If you are deleting the point, no need to append it
'hybridBody1.AppendHybridShape hybridShapePointCoord1
'New features are automatically the InWorkObject...and this is not needed
'part1.InWorkObject = hybridShapePointCoord1
'I would be careful updating the entire part...if the user has a feature that fails, the code will fail here
'part1.Update 
'Instead, local update only what you created
hybridShapePointCoord1.compute
'Try getting rid of the reference
'Set reference2 = part1.CreateReferenceFromObject(hybridShapePointCoord1)
'Use the point instead of the reference
Set hybridShapePointExplicit1 = hybridShapeFactory1.AddNewPointDatum(hybridShapePointCoord1)

hybridBody1.AppendHybridShape hybridShapePointExplicit1
'Local update
hybridShapePointCoord1.compute
'Don't need
'part1.InWorkObject = hybridShapePointExplicit1

hybridShapeFactory1.DeleteObjectForDatum hybridShapePointCoord1

'part1.Update
 
I'd just suck it down and do it manually, I don't give a fuck, I once File > Save As about 3000 files on Unix. Could I have written a macro? Yeah if I knew how it all worked under Unix and CATIA V4. So I just said: "fuck it." and I did it by hand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top