Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

import file read/change parameters

Message 1 of 3
202 Views, 2 Replies

import file read/change parameters

Im trying to read/change parameters of a imported file.

How would i do this?



	Ptr<FileDialog> fileDialog = ui->createFileDialog();
	fileDialog->filter("fusion File (*.f3d);;All files (*.*)");
	if (fileDialog->showOpen() == adsk::core::DialogResults::DialogOK)
		std::string filename = fileDialog->filename();

		Ptr<Component> rootComp = des->rootComponent();
		if (!rootComp)
			return false;
		Ptr<FusionArchiveImportOptions> archive_options = im->createFusionArchiveImportOptions(filename);
		if (!archive_options)
			return false;

		im->importToTarget2(archive_options, rootComp);
Message 2 of 3
in reply to: WrapItToTapIt

The importToTarget2 method returns an ObjectCollection of occurrences.  In most cases this will contain a collection of one occurrences but it depends on the file being read in.  An occurrence represents a component in an assembly. It defines it's position and can have color overrides.  From an occurrence you can use its component property to get the component it's representing. The component you get is a regular component and from it you can use the modelParameters property to get the parameters specific to that component. You can use the Parameters.itemByName property to get a specific parameter and you can change the value of the parameter.

Brian Ekins
Inventor and Fusion 360 API Expert
Message 3 of 3

sorry replied to wrong message


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

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report