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: 

Rotate Sketched Symbol with iLogic

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
LiliaE
698 Views, 6 Replies

Rotate Sketched Symbol with iLogic

Hej

 

I would like to rotate existing Sketched Symbol with iLogic. I can scale it with this code, but I can't use the same to rotate.

 

For Each sketched As SketchedSymbol In oSheet.SketchedSymbols
      If (sketched.Name = "Snit_C") Then
          sketched.Scale = 2
        sketched.Rotate = 30
        
      End If
Next

 

It get error:

Error in rule: SymbolRul, in document: TS_FG_BR.idw
Det offentlige medlem 'Rotate' i typen 'SketchedSymbol' blev ikke fundet.

 

If anyone can help. It will be nice.

Lilia

6 REPLIES 6
Message 2 of 7
philippe.leefsma
in reply to: LiliaE

The correct spelling of the property is "Rotation" and not "Rotate".

 

Check the Help Files in case of a doubt.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 3 of 7
LiliaE
in reply to: philippe.leefsma

Thank you, Philippe !!!
It has helped. The reason I spelled it that way in the program.
 
Udklip.JPG
 
 
Regards, Lilia.
Message 4 of 7
c.rp.henderson
in reply to: LiliaE

I want to achieve something very similar. I have a symbol on my drawing and I want a rule to change it's scale to match the scale of another view I have

Something like this:

SymbolScale ("Scaled Man") = ActiveSheet.View(View(2)).ScaleString

 

So far I have copy pasted what you have, see below but get errors

For Each sketched As SketchedSymbol In oSheet.SketchedSymbols
      If (sketched.Name = "Scaled Man") Then
          sketched.Scale = 2
sketched.Rotation = 30
End If Next 

I'm very new to iLogic so don't really understand these errors:

Error on Line 1 : Type 'SketchedSymbol' is not defined.

Error on Line 1 : 'oSheet' is not declared. It may be inaccessible due to its protection level.

 

Maybe there's something even simpler I could do?



Craig Henderson
Inventor Pro 2018.3.3, Build 284 / Vault Pro 2018 / Visual Studio 2012 / Excel 2013
Message 5 of 7

For Each oSheet As Sheet in ThisApplication.ActiveDocument.Sheets

For
Each sketched As SketchedSymbol In oSheet.SketchedSymbols If (sketched.Name = "Scaled Man") Then sketched.Scale = 2
sketched.Rotation = 30
End If Next 
Next

Untested, but should work. You were missing the declaration for oSheet, as the plain english in the error stack suggests. oSheet needs a declaration as it is a variable created by the user and not native to the API.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 6 of 7

Thanks for that explanation, it works perfect now for that appliction.

I've encountered another issue however, I want my sketched symbol scale to be set the same as another drawing view scale.

I have the following code but get this error: "Conversion from string "1/15.25" to type 'Double' is not valid."

 

For Each oSheet As Sheet In ThisApplication.ActiveDocument.Sheets

  For Each sketched As SketchedSymbol In oSheet.SketchedSymbols
      If (sketched.Name = "Scaled Man") Then
          sketched.Scale = ActiveSheet.View("ELEVATION").ScaleString
         
      End If
  Next 
Next

 How can I convert this to a 'double'?

 

I have this piece of code which applies the scale from one view to another, which I've tried to use in a similar way above. However I understand in this instance it's simpler as I'm going from string to string.

ActiveSheet.View("PERSPECTIVE").ScaleString = ActiveSheet.View("ELEVATION").ScaleString  

 



Craig Henderson
Inventor Pro 2018.3.3, Build 284 / Vault Pro 2018 / Visual Studio 2012 / Excel 2013
Message 7 of 7

Soke too soon. No error when I remove the word 'String' from this line

 

sketched.Scale = ActiveSheet.View("ELEVATION").Scale

 



Craig Henderson
Inventor Pro 2018.3.3, Build 284 / Vault Pro 2018 / Visual Studio 2012 / Excel 2013

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

Post to forums  

Autodesk Design & Make Report