change sketch parameters (done in dwg file)

change sketch parameters (done in dwg file)

marcin_bargiel
Advocate Advocate
804 Views
6 Replies
Message 1 of 7

change sketch parameters (done in dwg file)

marcin_bargiel
Advocate
Advocate

I attached dwg drawing with simple "Sketch1" in which i have 3 parameters (dimensions) : d0, d1, d2.

How can i change it ??? i need it many times when creating sections (in different orientation)

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
Accepted solutions (1)
805 Views
6 Replies
Replies (6)
Message 2 of 7

Sergio.D.Suárez
Mentor
Mentor

Are you going to work in Inventor or Autocad? because in inventor you could try to work with blocks, to then take these blocks to autocad, since once parameterized it is quick to make the changes to each block.
Excuse me if I did not understand your need, explain us a little better to be able to help in the best way, greetings.


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 7

marcin_bargiel
Advocate
Advocate

Thank You yuvilo_ but You completely did not understand what I meant, it has to be done in SKETCH which is created in drawing DWG not in Part IPT ! (this is a trivial task for someone who started working with the inventor yesterday 🙂 )

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
Message 4 of 7

marcin_bargiel
Advocate
Advocate

Please take a look into my dwg file

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
Message 5 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@marcin_bargiel ,

 

Try below iLogic code to change the dimensions of sketch.

d = InputBox("Enter d0", "Sketch dimensions", "4 in")
d1 = InputBox("Enter d1", "Sketch dimensions", "5 in")
d2 = InputBox("Enter d2", "Sketch dimensions", "35 deg")

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet

Dim oSketch As DrawingSketch
oSketch = oSheet.Sketches.Item(1) 

Dim oConstraint As DimensionConstraint
For Each oConstraint In oSketch.DimensionConstraints	
    If oConstraint.Parameter.Name = "d0" Then
        oConstraint.Parameter.Expression = d
	Else If oConstraint.Parameter.Name = "d1" Then
        oConstraint.Parameter.Expression = d1 
	Else If oConstraint.Parameter.Name = "d2" Then
    	oConstraint.Parameter.Expression = d2 
    End If
Next
Call oSketch.Solve 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 6 of 7

marcin_bargiel
Advocate
Advocate

Thank's a lot !

It works good, one thing only i can't figure it out - how can update this sheet automatically ? it change only when i click on it. I tried this - but wihout result...

 

Dim oCurrentSheet As Sheet
oCurrentSheet = ThisDoc.Document.ActiveSheet
	
	' Iterate through the sheets
	Dim oSheet As Sheet
	For Each oSheet In ThisDoc.Document.Sheets
		oSheet.Activate
		oSheet.Update	
	Next
	
'return to original sheet	
oCurrentSheet.Activate
Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
Message 7 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support

@marcin_bargiel,

 

Code looks fine for me. Can you please demonstrate the situation with video record or screencast? please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes