iLogic Updating User parameters SheetMetal

iLogic Updating User parameters SheetMetal

cjuliao
Enthusiast Enthusiast
870 Views
5 Replies
Message 1 of 6

iLogic Updating User parameters SheetMetal

cjuliao
Enthusiast
Enthusiast

Hi everyone!

I'm new on this iLogic thingy, i just build things. This is a whole new world for me.

 

So i'm working on a sheet metal part and this is what i want:

  •  Always automatically update my "user parameters" each time something change on a sheet metal part.
    • My user parameters:
      • Area_SM ( meaning Area of Stock Material);
      • Length (Length of the Flat Pattern of Stock Material);
      • Width (width of the Flat pattern of Stock material).

This is what it's written:

Dim oDoc As PartDocument
oDoc = ThisDoc.Document
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oDoc.ComponentDefinition
If oSMDef.HasFlatPattern = Then
	Area_SM = extents_area = SheetMetal.FlatExtentsArea
	Length = extents_length = SheetMetal.FlatExtentsLength
	Width = extents_width = SheetMetal.FlatExtentsWidth
Else
Area_SM = 0 Length = 0 Width = 0 End If

What i dont what:

- If i dont have ony Flat pattern created, then dont create a flat pattern until i do/say so;

 

i tried feature.("flatpattern") = true, FlatPattern is nothing.....etc.

As you can guess, i understand 000.....00 about coding. just a 30min. ago i learned what Dim was, and why it was always defined at the start, still dont know what "o(something)" stands for.

 

i want to understand how this works but please dont right the anwser right way, make me understand 1st.

I'm still searching for tutorials and posts as examples, actually this coding was copy-paste then I modeled it into my needs.

 

Best regards,

JHG

0 Likes
Accepted solutions (1)
871 Views
5 Replies
Replies (5)
Message 2 of 6

Curtis_Waguespack
Consultant
Consultant

Hi cjuliao ,

 

Welcome to the forum.

 

What you have is very close to being correct. You just have a few syntax errors.

 

Firstly you need to add = True as shown and then you just need to remove the extra " = extents_" stuff.

 

Here's what your code should look like:

 

rrr.JPG

 

As for getting a better understanding of why it didn't work, i'm not sure I can provide a detailed explanation.... other than it just has to be written in a certain syntax to compile correctly. I think with the corrected example you can learn from what you had to what it should be though.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too, as that is the better forum for these types of questions.
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 3 of 6

Mark.Lancaster
Consultant
Consultant

The highlight mask marvel strikes again..

 

2019-09-05_15-59-52.jpg

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

Message 4 of 6

Curtis_Waguespack
Consultant
Consultant

😀

 

zzz.png

EESignature

Message 5 of 6

cjuliao
Enthusiast
Enthusiast

Thanks alot Curtis,

 

Still it doesn't work.userParam.png

Area_MP (=Area SM)

Comprimento (=Length)

Largura (=width)

 

Area SM it never changes when i change the sheet plate geometry.

 

But thanks alot any ways for the forums tips. looking foward start investigating further.

 

Best regards to all of you.

JHG

0 Likes
Message 6 of 6

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@cjuliao wrote:

 

 

Area SM it never changes when i change the sheet plate geometry.

 


Hi cjuliao ,

 

The rule will not run unless we set a trigger to watch the parameters for changes, something like this where we watch the paramters called Leg1, Leg2 and Angle1... so that if any of these three values change then the rule runs.

 

fff.JPG

 

oTrigger = Leg1
oTrigger = Leg2
oTrigger = Angle1

Dim oDoc As PartDocument
oDoc = ThisDoc.Document
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oDoc.ComponentDefinition
If oSMDef.HasFlatPattern = True Then
	Area_SM =  SheetMetal.FlatExtentsArea
	Length =  SheetMetal.FlatExtentsLength
	Width =  SheetMetal.FlatExtentsWidth
Else
    Area_SM = 0
	Length = 0
	Width = 0
End If

EESignature

0 Likes