Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

problem with update a extrude with Ilogic

1 REPLY 1
SOLVED
Reply
Message 1 of 2
yomarposada
133 Views, 1 Reply

problem with update a extrude with Ilogic

Hello everyone, I'm new and I have been trying to change an extrude value using iLogic, but I'm encountering a problem.

 

The idea is that if the value I enter goes over 3050 mm (the max length the store sells), then iLogic should just bring it back down to 3050 mm and give me a heads-up.

 

Once I enter an extrude value, the rule runs and displays the correct number. However, when the extrusion is performed, the program adds a zero at the end of the number. For example, if I enter 5050, the rule shows that it has been changed to 3030, but the extrusion ends up being 30500, if I enter 250, it displays 250, but the extrusion becomes 2500.

 

 

1.png2.png3.png

I have no idea what I am doing wrong.

 

 

Sub Main()
    Dim oPartDoc As PartDocument = ThisDoc.Document
    Dim oExtrusion As ExtrudeFeature = oPartDoc.ComponentDefinition.Features.ExtrudeFeatures.Item(1)
    Dim NewLength As Double = Length

    If NewLength > 3050 Then
		MessageBox.Show("Como vas a poner un perfil de " & NewLength.ToString()& " don retrasao", "OE AWEONAO")
        NewLength = 3050
    End If
	
    oExtrusion.SetDistanceExtent(DirectCast(NewLength, System.ValueType), PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)

    oPartDoc.Update()
	
	MessageBox.Show("Ya le cambiamos el perfil a " & NewLength & " mm.", "ome pendejo", MessageBoxButtons.OK, MessageBoxIcon.Information)
	
End Sub

 

 

 

4.png

 

Thank you very much for your help, I appreciate it.

Tags (2)
Labels (2)
1 REPLY 1
Message 2 of 2
A.Acheson
in reply to: yomarposada

Hi @yomarposada 

 

Any number entered in the code will be automatically in system units which is cm. If you want 250mm then perform the conversion yourself by entering 25 or you can also give a string value such as "250 mm".

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report